일반적인 트래피킹 작업

이 페이지에서는 DCM/DFA Reporting API 및 트래피킹 API를 사용하여 가장 일반적인 트래피킹 작업을 수행하는 방법을 설명합니다.

일반 코딩 도움말

  • 필수 및 선택 속성 및 매개변수 - API 호출에 속성 또는 매개변수가 필요한지 알아보려면 참조 문서를 확인하세요.
  • 와일드 카드 이름 검색 - 객체 이름을 검색할 때 별표 (*) 와일드 카드를 사용할 수 있습니다. 별표는 0개 이상의 문자와 일치합니다. 또한 API는 암시적 하위 문자열 검색을 지원하므로 'abc'를 검색하면 암시적으로 '*abc*'가 검색됩니다.
  • 업데이트와 패치 비교 - 기존 객체를 수정하는 방법에는 두 가지가 있습니다.
    1. 업데이트 - 개체를 업데이트하면 삽입 시 모든 필드를 덮어씁니다. 업데이트할 객체를 로드하고 해당 객체를 변경하는 것이 중요합니다. 그렇지 않으면 업데이트 요청에 없는 모든 필드가 설정 해제됩니다.
    2. 패치 - 패치하면 삽입 시 지정된 입력란만 덮어써집니다. 이 경우 새 객체를 만들어 업데이트할 객체와 동일한 ID를 할당하고 업데이트할 필드를 설정하고 패치 요청을 실행할 수 있습니다.
  • 크기 - 실제 크기는 크기 서비스에서 정의한 Size 객체로 표현됩니다. 계정에서 표준 크기 세트를 제공하며 이 목록에 맞춤 크기를 추가할 수 있습니다.
  • 날짜 및 시간 - 현지 시간대를 사용하여 RFC 3339 형식으로 날짜/시간을 저장할 수 있습니다. API에서 반환하는 모든 값은 UTC 기준입니다. 이는 구성된 시간대 (기본적으로 미국/뉴욕 시간)로 날짜와 시간이 표시되는 웹사이트와 다릅니다.

광고주 생성

C#

  1. Advertiser 객체를 만들고 필수 namestatus 속성을 설정합니다.
    // Create the advertiser structure.
    Advertiser advertiser = new Advertiser();
    advertiser.Name = advertiserName;
    advertiser.Status = "APPROVED";
    
  2. advertisers.insert()를 호출하여 광고주를 저장합니다.
    // Create the advertiser.
    Advertiser result = service.Advertisers.Insert(advertiser, profileId).Execute();
    

Java

  1. Advertiser 객체를 만들고 필수 namestatus 속성을 설정합니다.
    // Create the advertiser structure.
    Advertiser advertiser = new Advertiser();
    advertiser.setName(advertiserName);
    advertiser.setStatus("APPROVED");
    
  2. advertisers.insert()를 호출하여 광고주를 저장합니다.
    // Create the advertiser.
    Advertiser result = reporting.advertisers().insert(profileId, advertiser).execute();
    

2,399필리핀

  1. Advertiser 객체를 만들고 필수 namestatus 속성을 설정합니다.
    $advertiser = new Google_Service_Dfareporting_Advertiser();
    $advertiser->setName($values['advertiser_name']);
    $advertiser->setStatus('APPROVED');
    
  2. advertisers.insert()를 호출하여 광고주를 저장합니다.
    $result = $this->service->advertisers->insert(
        $values['user_profile_id'],
        $advertiser
    );
    

Python

  1. Advertiser 객체를 만들고 필수 namestatus 속성을 설정합니다.
    # Construct and save advertiser.
    advertiser = {
        'name': 'Test Advertiser',
        'status': 'APPROVED'
    }
    
  2. advertisers.insert()를 호출하여 광고주를 저장합니다.
    request = service.advertisers().insert(
        profileId=profile_id, body=advertiser)
    
    # Execute request and print response.
    response = request.execute()
    

Ruby

  1. Advertiser 객체를 만들고 필수 namestatus 속성을 설정합니다.
    # Create a new advertiser resource to insert.
    advertiser = DfareportingUtils::API_NAMESPACE::Advertiser.new(
      name: format('Example Advertiser #%s', SecureRandom.hex(3)),
      status: 'APPROVED'
    )
    
  2. advertisers.insert()를 호출하여 광고주를 저장합니다.
    # Insert the advertiser.
    result = service.insert_advertiser(profile_id, advertiser)
    

캠페인 만들기

C#

  1. Campaign 객체를 만들고 필수 속성을 설정합니다.

    • advertiserId - 이 캠페인과 연결할 광고주입니다.
    • name - 이 광고주의 모든 캠페인에서 고유해야 합니다.
    • defaultLandingPageId: 사용자가 이 캠페인의 광고를 클릭했을 때 연결되는 방문 페이지입니다(광고에 할당되지 않은 경우). advertiserLandingPages.list를 호출하여 기존 방문 페이지를 조회하거나 advertiserLandingPages.insert를 호출하여 새 방문 페이지를 만들 수 있습니다.
    • Startend 날짜 - 미래 날짜여야 하며 정확한 날짜를 설정할 수 있습니다. 자세한 내용은 일반 코딩 정보의 날짜 및 시간 항목을 참조하세요. 개별 광고 날짜는 종료일을 초과할 수 있으며, 지정된 캠페인 종료일이 되지 않은 경우 게시자가 지정된 수의 작업에 대한 계약을 이행할 수 있도록 하기 위함입니다.
    // Locate an advertiser landing page to use as a default.
    LandingPage defaultLandingPage = getAdvertiserLandingPage(service, profileId, advertiserId);
    
    // Create the campaign structure.
    Campaign campaign = new Campaign();
    campaign.Name = campaignName;
    campaign.AdvertiserId = advertiserId;
    campaign.Archived = false;
    campaign.DefaultLandingPageId = defaultLandingPage.Id;
    
    // Set the campaign start date. This example uses today's date.
    campaign.StartDate =
        DfaReportingDateConverterUtil.convertToDateString(DateTime.Now);
    
    // Set the campaign end date. This example uses one month from today's date.
    campaign.EndDate =
        DfaReportingDateConverterUtil.convertToDateString(DateTime.Now.AddMonths(1));
    
  2. campaigns.insert()를 호출하여 캠페인을 저장합니다.

    // Insert the campaign.
    Campaign result = service.Campaigns.Insert(campaign, profileId).Execute();
    

Java

  1. Campaign 객체를 만들고 필수 속성을 설정합니다.

    • advertiserId - 이 캠페인과 연결할 광고주입니다.
    • name - 이 광고주의 모든 캠페인에서 고유해야 합니다.
    • defaultLandingPageId: 사용자가 이 캠페인의 광고를 클릭했을 때 연결되는 방문 페이지입니다(광고에 할당되지 않은 경우). advertiserLandingPages.list를 호출하여 기존 방문 페이지를 조회하거나 advertiserLandingPages.insert를 호출하여 새 방문 페이지를 만들 수 있습니다.
    • Startend 날짜 - 미래 날짜여야 하며 정확한 날짜를 설정할 수 있습니다. 자세한 내용은 일반 코딩 정보의 날짜 및 시간 항목을 참조하세요. 개별 광고 날짜는 종료일을 초과할 수 있으며, 지정된 캠페인 종료일이 되지 않은 경우 게시자가 지정된 수의 작업에 대한 계약을 이행할 수 있도록 하기 위함입니다.
    // Locate an advertiser landing page to use as a default.
    LandingPage defaultLandingPage = getAdvertiserLandingPage(reporting, profileId, advertiserId);
    
    // Create the campaign structure.
    Campaign campaign = new Campaign();
    campaign.setName(campaignName);
    campaign.setAdvertiserId(advertiserId);
    campaign.setArchived(false);
    campaign.setDefaultLandingPageId(defaultLandingPage.getId());
    
    // Set the campaign start date. This example uses today's date.
    Calendar today = Calendar.getInstance();
    DateTime startDate = new DateTime(true, today.getTimeInMillis(), null);
    campaign.setStartDate(startDate);
    
    // Set the campaign end date. This example uses one month from today's date.
    Calendar nextMonth = Calendar.getInstance();
    nextMonth.add(Calendar.MONTH, 1);
    DateTime endDate = new DateTime(true, nextMonth.getTimeInMillis(), null);
    campaign.setEndDate(endDate);
    
  2. campaigns.insert()를 호출하여 캠페인을 저장합니다.

    // Insert the campaign.
    Campaign result = reporting.campaigns().insert(profileId, campaign).execute();
    

2,399필리핀

  1. Campaign 객체를 만들고 필수 속성을 설정합니다.

    • advertiserId - 이 캠페인과 연결할 광고주입니다.
    • name - 이 광고주의 모든 캠페인에서 고유해야 합니다.
    • defaultLandingPageId: 사용자가 이 캠페인의 광고를 클릭했을 때 연결되는 방문 페이지입니다(광고에 할당되지 않은 경우). advertiserLandingPages.list를 호출하여 기존 방문 페이지를 조회하거나 advertiserLandingPages.insert를 호출하여 새 방문 페이지를 만들 수 있습니다.
    • Startend 날짜 - 미래 날짜여야 하며 정확한 날짜를 설정할 수 있습니다. 자세한 내용은 일반 코딩 정보의 날짜 및 시간 항목을 참조하세요. 개별 광고 날짜는 종료일을 초과할 수 있으며, 지정된 캠페인 종료일이 되지 않은 경우 게시자가 지정된 수의 작업에 대한 계약을 이행할 수 있도록 하기 위함입니다.
    $startDate = new DateTime('today');
    $endDate = new DateTime('+1 month');
    
    $campaign = new Google_Service_Dfareporting_Campaign();
    $campaign->setAdvertiserId($values['advertiser_id']);
    $campaign->setDefaultLandingPageId($values['default_landing_page_id']);
    $campaign->setName($values['campaign_name']);
    $campaign->setStartDate($startDate->format('Y-m-d'));
    $campaign->setEndDate($endDate->format('Y-m-d'));
    
  2. campaigns.insert()를 호출하여 캠페인을 저장합니다.

    $result = $this->service->campaigns->insert(
        $values['user_profile_id'],
        $campaign
    );
    

Python

  1. Campaign 객체를 만들고 필수 속성을 설정합니다.

    • advertiserId - 이 캠페인과 연결할 광고주입니다.
    • name - 이 광고주의 모든 캠페인에서 고유해야 합니다.
    • defaultLandingPageId: 사용자가 이 캠페인의 광고를 클릭했을 때 연결되는 방문 페이지입니다(광고에 할당되지 않은 경우). advertiserLandingPages.list를 호출하여 기존 방문 페이지를 조회하거나 advertiserLandingPages.insert를 호출하여 새 방문 페이지를 만들 수 있습니다.
    • Startend 날짜 - 미래 날짜여야 하며 정확한 날짜를 설정할 수 있습니다. 자세한 내용은 일반 코딩 정보의 날짜 및 시간 항목을 참조하세요. 개별 광고 날짜는 종료일을 초과할 수 있으며, 지정된 캠페인 종료일이 되지 않은 경우 게시자가 지정된 수의 작업에 대한 계약을 이행할 수 있도록 하기 위함입니다.
    # Locate an advertiser landing page to use as a default.
    default_landing_page = get_advertiser_landing_page(service, profile_id,
                                                       advertiser_id)
    
    # Construct and save campaign.
    campaign = {
        'name': 'Test Campaign #%s' % uuid.uuid4(),
        'advertiserId': advertiser_id,
        'archived': 'false',
        'defaultLandingPageId': default_landing_page['id'],
        'startDate': '2015-01-01',
        'endDate': '2020-01-01'
    }
    
  2. campaigns.insert()를 호출하여 캠페인을 저장합니다.

    request = service.campaigns().insert(profileId=profile_id, body=campaign)
    
    # Execute request and print response.
    response = request.execute()
    

Ruby

  1. Campaign 객체를 만들고 필수 속성을 설정합니다.

    • advertiserId - 이 캠페인과 연결할 광고주입니다.
    • name - 이 광고주의 모든 캠페인에서 고유해야 합니다.
    • defaultLandingPageId: 사용자가 이 캠페인의 광고를 클릭했을 때 연결되는 방문 페이지입니다(광고에 할당되지 않은 경우). advertiserLandingPages.list를 호출하여 기존 방문 페이지를 조회하거나 advertiserLandingPages.insert를 호출하여 새 방문 페이지를 만들 수 있습니다.
    • Startend 날짜 - 미래 날짜여야 하며 정확한 날짜를 설정할 수 있습니다. 자세한 내용은 일반 코딩 정보의 날짜 및 시간 항목을 참조하세요. 개별 광고 날짜는 종료일을 초과할 수 있으며, 지정된 캠페인 종료일이 되지 않은 경우 게시자가 지정된 수의 작업에 대한 계약을 이행할 수 있도록 하기 위함입니다.
    # Locate an advertiser landing page to use as a default.
    default_landing_page = get_advertiser_landing_page(service, profile_id,
      advertiser_id)
    
    # Create a new campaign resource to insert.
    campaign = DfareportingUtils::API_NAMESPACE::Campaign.new(
      advertiser_id: advertiser_id,
      archived: false,
      default_landing_page_id: default_landing_page.id,
      name: format('Example Campaign #%s', SecureRandom.hex(3)),
      start_date: '2014-01-01',
      end_date: '2020-01-01'
    )
    
  2. campaigns.insert()를 호출하여 캠페인을 저장합니다.

    # Insert the campaign.
    result = service.insert_campaign(profile_id, campaign)
    

게재위치 만들기

C#

  1. Placement 객체를 만들고 필수 게재위치 속성 (campaignIdsiteId 포함)을 설정합니다. 또한 웹사이트와 협상한 게재위치의 게재위치 유형과 크기를 정확하게 설정해야 합니다.
    // Create the placement.
    Placement placement = new Placement();
    placement.Name = placementName;
    placement.CampaignId = campaignId;
    placement.Compatibility = "DISPLAY";
    placement.PaymentSource = "PLACEMENT_AGENCY_PAID";
    placement.SiteId = dfaSiteId;
    placement.TagFormats = new List<string>() { "PLACEMENT_TAG_STANDARD" };
    
    // Set the size of the placement.
    Size size = new Size();
    size.Id = sizeId;
    placement.Size = size;
    
  2. 게재위치에 할당할 새 PricingSchedule 객체를 만듭니다.
    // Set the pricing schedule for the placement.
    PricingSchedule pricingSchedule = new PricingSchedule();
    pricingSchedule.EndDate = campaign.EndDate;
    pricingSchedule.PricingType = "PRICING_TYPE_CPM";
    pricingSchedule.StartDate = campaign.StartDate;
    placement.PricingSchedule = pricingSchedule;
    
  3. placements.insert()를 호출하여 Placement 객체를 저장합니다. 반환된 ID를 사용하여 광고 또는 광고 소재에 할당하려는 경우 반환된 ID를 저장해야 합니다.
    // Insert the placement.
    Placement result = service.Placements.Insert(placement, profileId).Execute();
    

Java

  1. Placement 객체를 만들고 필수 게재위치 속성 (campaignIdsiteId 포함)을 설정합니다. 또한 웹사이트와 협상한 게재위치의 게재위치 유형과 크기를 정확하게 설정해야 합니다.
    // Create the placement.
    Placement placement = new Placement();
    placement.setName(placementName);
    placement.setCampaignId(campaignId);
    placement.setCompatibility("DISPLAY");
    placement.setPaymentSource("PLACEMENT_AGENCY_PAID");
    placement.setSiteId(dfaSiteId);
    placement.setTagFormats(ImmutableList.of("PLACEMENT_TAG_STANDARD"));
    
    // Set the size of the placement.
    Size size = new Size();
    size.setId(sizeId);
    placement.setSize(size);
    
  2. 게재위치에 할당할 새 PricingSchedule 객체를 만듭니다.
    // Set the pricing schedule for the placement.
    PricingSchedule pricingSchedule = new PricingSchedule();
    pricingSchedule.setEndDate(campaign.getEndDate());
    pricingSchedule.setPricingType("PRICING_TYPE_CPM");
    pricingSchedule.setStartDate(campaign.getStartDate());
    placement.setPricingSchedule(pricingSchedule);
    
  3. placements.insert()를 호출하여 Placement 객체를 저장합니다. 반환된 ID를 사용하여 광고 또는 광고 소재에 할당하려는 경우 반환된 ID를 저장해야 합니다.
    // Insert the placement.
    Placement result = reporting.placements().insert(profileId, placement).execute();
    

2,399필리핀

  1. Placement 객체를 만들고 필수 게재위치 속성 (campaignIdsiteId 포함)을 설정합니다. 또한 웹사이트와 협상한 게재위치의 게재위치 유형과 크기를 정확하게 설정해야 합니다.
    $placement = new Google_Service_Dfareporting_Placement();
    $placement->setCampaignId($values['campaign_id']);
    $placement->setCompatibility('DISPLAY');
    $placement->setName($values['placement_name']);
    $placement->setPaymentSource('PLACEMENT_AGENCY_PAID');
    $placement->setSiteId($values['site_id']);
    $placement->setTagFormats(['PLACEMENT_TAG_STANDARD']);
    
    // Set the size of the placement.
    $size = new Google_Service_Dfareporting_Size();
    $size->setId($values['size_id']);
    $placement->setSize($size);
    
  2. 게재위치에 할당할 새 PricingSchedule 객체를 만듭니다.
    // Set the pricing schedule for the placement.
    $pricingSchedule = new Google_Service_Dfareporting_PricingSchedule();
    $pricingSchedule->setEndDate($campaign->getEndDate());
    $pricingSchedule->setPricingType('PRICING_TYPE_CPM');
    $pricingSchedule->setStartDate($campaign->getStartDate());
    $placement->setPricingSchedule($pricingSchedule);
    
  3. placements.insert()를 호출하여 Placement 객체를 저장합니다. 반환된 ID를 사용하여 광고 또는 광고 소재에 할당하려는 경우 반환된 ID를 저장해야 합니다.
    // Insert the placement.
    $result = $this->service->placements->insert(
        $values['user_profile_id'],
        $placement
    );
    

Python

  1. Placement 객체를 만들고 필수 게재위치 속성 (campaignIdsiteId 포함)을 설정합니다. 또한 웹사이트와 협상한 게재위치의 게재위치 유형과 크기를 정확하게 설정해야 합니다.
    # Construct and save placement.
    placement = {
        'name': 'Test Placement',
        'campaignId': campaign_id,
        'compatibility': 'DISPLAY',
        'siteId': site_id,
        'size': {
            'height': '1',
            'width': '1'
        },
        'paymentSource': 'PLACEMENT_AGENCY_PAID',
        'tagFormats': ['PLACEMENT_TAG_STANDARD']
    }
    
  2. 게재위치에 할당할 새 PricingSchedule 객체를 만듭니다.
    # Set the pricing schedule for the placement.
    placement['pricingSchedule'] = {
        'startDate': campaign['startDate'],
        'endDate': campaign['endDate'],
        'pricingType': 'PRICING_TYPE_CPM'
    }
    
  3. placements.insert()를 호출하여 Placement 객체를 저장합니다. 반환된 ID를 사용하여 광고 또는 광고 소재에 할당하려는 경우 반환된 ID를 저장해야 합니다.
    request = service.placements().insert(profileId=profile_id, body=placement)
    
    # Execute request and print response.
    response = request.execute()
    

Ruby

  1. Placement 객체를 만들고 필수 게재위치 속성 (campaignIdsiteId 포함)을 설정합니다. 또한 웹사이트와 협상한 게재위치의 게재위치 유형과 크기를 정확하게 설정해야 합니다.
    # Create a new placement resource to insert.
    placement = DfareportingUtils::API_NAMESPACE::Placement.new(
      campaign_id: campaign_id,
      compatibility: 'DISPLAY',
      name: 'Example Placement',
      payment_source: 'PLACEMENT_AGENCY_PAID',
      site_id: site_id,
      size: DfareportingUtils::API_NAMESPACE::Size.new(
        height: 1,
        width: 1
      ),
      tag_formats: ['PLACEMENT_TAG_STANDARD']
    )
    
  2. 게재위치에 할당할 새 PricingSchedule 객체를 만듭니다.
    # Set the pricing schedule for the placement.
    placement.pricing_schedule =
      DfareportingUtils::API_NAMESPACE::PricingSchedule.new(
        end_date: campaign.end_date,
        pricing_type: 'PRICING_TYPE_CPM',
        start_date: campaign.start_date
      )
    
  3. placements.insert()를 호출하여 Placement 객체를 저장합니다. 반환된 ID를 사용하여 광고 또는 광고 소재에 할당하려는 경우 반환된 ID를 저장해야 합니다.
    # Insert the placement strategy.
    result = service.insert_placement(profile_id, placement)
    

애셋 업로드

미디어 업로드라고 하는 과정을 통해 다양한 유형의 애셋을 업로드할 수 있습니다. 이 프로세스는 모든 광고 소재 유형에서 비슷하지만, 일부 유형의 경우 제대로 사용하기 위해 특정 속성을 메타데이터로 전달해야 할 수 있습니다.

C#

  1. assetIdentifier 객체를 만들고 필수 속성을 설정합니다. 유형 또는 사용 방법에 관계없이 모든 애셋에서 assetIdentifier를 지정해야 합니다. 광고 소재에 애셋을 할당할 때 이 객체는 애셋을 다시 참조하는 데 사용됩니다. 다음 속성은 필수입니다.

    • 서버에서 애셋의 이름이 될 name 속성 파일 이름은 .png 또는 .gif와 같이 파일 형식을 나타내는 확장자를 포함해야 하며 브라우저에 애셋 이름으로 노출됩니다. 단, 원본 파일 이름과 같을 필요는 없습니다. 이 이름은 서버에서 고유하게 만들기 위해 Campaign Manager 360에서 변경할 수 있습니다. 변경되었는지 보려면 반환 값을 확인하세요.
    • 애셋 유형을 식별하는 type 속성 이 속성은 이 애셋이 연결될 수 있는 광고 소재의 유형을 나타냅니다.
    // Create the creative asset ID and Metadata.
    CreativeAssetId assetId = new CreativeAssetId();
    assetId.Name = Path.GetFileName(assetFile);
    assetId.Type = assetType;
    
  2. creativeAssets.insert()를 호출하여 파일을 업로드합니다. 멀티파트 업로드를 실행하여 assetIdentifier와 파일 콘텐츠를 모두 동일한 요청의 일부로 전달합니다. 성공하면 CreativeAsset 리소스가 반환되며, 이 애셋을 광고 소재에 할당하는 데 사용할 assetIdentifier이 표시됩니다.

    // Prepare an input stream.
    FileStream assetContent = new FileStream(assetFile, FileMode.Open, FileAccess.Read);
    
    
    CreativeAssetMetadata metaData = new CreativeAssetMetadata();
    metaData.AssetIdentifier = assetId;
    
    // Insert the creative.
    String mimeType = determineMimeType(assetFile, assetType);
    CreativeAssetsResource.InsertMediaUpload request =
        Service.CreativeAssets.Insert(metaData, ProfileId, AdvertiserId, assetContent, mimeType);
    
    IUploadProgress progress = request.Upload();
    if (UploadStatus.Failed.Equals(progress.Status)) {
        throw progress.Exception;
    }
    

Java

  1. assetIdentifier 객체를 만들고 필수 속성을 설정합니다. 유형 또는 사용 방법에 관계없이 모든 애셋에서 assetIdentifier를 지정해야 합니다. 광고 소재에 애셋을 할당할 때 이 객체는 애셋을 다시 참조하는 데 사용됩니다. 다음 속성은 필수입니다.

    • 서버에서 애셋의 이름이 될 name 속성 파일 이름은 .png 또는 .gif와 같이 파일 형식을 나타내는 확장자를 포함해야 하며 브라우저에 애셋 이름으로 노출됩니다. 단, 원본 파일 이름과 같을 필요는 없습니다. 이 이름은 서버에서 고유하게 만들기 위해 Campaign Manager 360에서 변경할 수 있습니다. 변경되었는지 보려면 반환 값을 확인하세요.
    • 애셋 유형을 식별하는 type 속성 이 속성은 이 애셋이 연결될 수 있는 광고 소재의 유형을 나타냅니다.
    // Create the creative asset ID and Metadata.
    CreativeAssetId assetId = new CreativeAssetId();
    assetId.setName(assetName);
    assetId.setType(assetType);
    
  2. creativeAssets.insert()를 호출하여 파일을 업로드합니다. 멀티파트 업로드를 실행하여 assetIdentifier와 파일 콘텐츠를 모두 동일한 요청의 일부로 전달합니다. 성공하면 CreativeAsset 리소스가 반환되며, 이 애셋을 광고 소재에 할당하는 데 사용할 assetIdentifier이 표시됩니다.

    // Open the asset file.
    File file = new File(assetFile);
    
    // Prepare an input stream.
    String contentType = getMimeType(assetFile);
    InputStreamContent assetContent =
        new InputStreamContent(contentType, new BufferedInputStream(new FileInputStream(file)));
    assetContent.setLength(file.length());
    
    
    CreativeAssetMetadata metaData = new CreativeAssetMetadata();
    metaData.setAssetIdentifier(assetId);
    
    // Insert the creative.
    CreativeAssetMetadata result = reporting.creativeAssets()
        .insert(profileId, advertiserId, metaData, assetContent).execute();
    

2,399필리핀

  1. assetIdentifier 객체를 만들고 필수 속성을 설정합니다. 유형 또는 사용 방법에 관계없이 모든 애셋에서 assetIdentifier를 지정해야 합니다. 광고 소재에 애셋을 할당할 때 이 객체는 애셋을 다시 참조하는 데 사용됩니다. 다음 속성은 필수입니다.

    • 서버에서 애셋의 이름이 될 name 속성 파일 이름은 .png 또는 .gif와 같이 파일 형식을 나타내는 확장자를 포함해야 하며 브라우저에 애셋 이름으로 노출됩니다. 단, 원본 파일 이름과 같을 필요는 없습니다. 이 이름은 서버에서 고유하게 만들기 위해 Campaign Manager 360에서 변경할 수 있습니다. 변경되었는지 보려면 반환 값을 확인하세요.
    • 애셋 유형을 식별하는 type 속성 이 속성은 이 애셋이 연결될 수 있는 광고 소재의 유형을 나타냅니다.
    $assetId = new Google_Service_Dfareporting_CreativeAssetId();
    $assetId->setName($asset['name']);
    $assetId->setType($type);
    
  2. creativeAssets.insert()를 호출하여 파일을 업로드합니다. 멀티파트 업로드를 실행하여 assetIdentifier와 파일 콘텐츠를 모두 동일한 요청의 일부로 전달합니다. 성공하면 CreativeAsset 리소스가 반환되며, 이 애셋을 광고 소재에 할당하는 데 사용할 assetIdentifier이 표시됩니다.

    $metadata = new Google_Service_Dfareporting_CreativeAssetMetadata();
    $metadata->setAssetIdentifier($assetId);
    
    $result = $service->creativeAssets->insert(
        $userProfileId,
        $advertiserId,
        $metadata,
        ['data' => file_get_contents($asset['tmp_name']),
         'mimeType' => $asset['type'],
         'uploadType' => 'multipart']
    );
    

Python

  1. assetIdentifier 객체를 만들고 필수 속성을 설정합니다. 유형 또는 사용 방법에 관계없이 모든 애셋에서 assetIdentifier를 지정해야 합니다. 광고 소재에 애셋을 할당할 때 이 객체는 애셋을 다시 참조하는 데 사용됩니다. 다음 속성은 필수입니다.

    • 서버에서 애셋의 이름이 될 name 속성 파일 이름은 .png 또는 .gif와 같이 파일 형식을 나타내는 확장자를 포함해야 하며 브라우저에 애셋 이름으로 노출됩니다. 단, 원본 파일 이름과 같을 필요는 없습니다. 이 이름은 서버에서 고유하게 만들기 위해 Campaign Manager 360에서 변경할 수 있습니다. 변경되었는지 보려면 반환 값을 확인하세요.
    • 애셋 유형을 식별하는 type 속성 이 속성은 이 애셋이 연결될 수 있는 광고 소재의 유형을 나타냅니다.
    # Construct the creative asset metadata
    creative_asset = {'assetIdentifier': {'name': asset_name, 'type': asset_type}}
    
  2. creativeAssets.insert()를 호출하여 파일을 업로드합니다. 멀티파트 업로드를 실행하여 assetIdentifier와 파일 콘텐츠를 모두 동일한 요청의 일부로 전달합니다. 성공하면 CreativeAsset 리소스가 반환되며, 이 애셋을 광고 소재에 할당하는 데 사용할 assetIdentifier이 표시됩니다.

    media = MediaFileUpload(path_to_asset_file)
    if not media.mimetype():
      media = MediaFileUpload(path_to_asset_file, 'application/octet-stream')
    
    response = service.creativeAssets().insert(
        advertiserId=advertiser_id,
        profileId=profile_id,
        media_body=media,
        body=creative_asset).execute()
    

Ruby

  1. assetIdentifier 객체를 만들고 필수 속성을 설정합니다. 유형 또는 사용 방법에 관계없이 모든 애셋에서 assetIdentifier를 지정해야 합니다. 광고 소재에 애셋을 할당할 때 이 객체는 애셋을 다시 참조하는 데 사용됩니다. 다음 속성은 필수입니다.

    • 서버에서 애셋의 이름이 될 name 속성 파일 이름은 .png 또는 .gif와 같이 파일 형식을 나타내는 확장자를 포함해야 하며 브라우저에 애셋 이름으로 노출됩니다. 단, 원본 파일 이름과 같을 필요는 없습니다. 이 이름은 서버에서 고유하게 만들기 위해 Campaign Manager 360에서 변경할 수 있습니다. 변경되었는지 보려면 반환 값을 확인하세요.
    • 애셋 유형을 식별하는 type 속성 이 속성은 이 애셋이 연결될 수 있는 광고 소재의 유형을 나타냅니다.
    # Construct the creative asset metadata
    creative_asset = DfareportingUtils::API_NAMESPACE::CreativeAsset.new(
      asset_identifier: DfareportingUtils::API_NAMESPACE::CreativeAssetId.new(
        name: asset_name,
        type: asset_type
      )
    )
    
  2. creativeAssets.insert()를 호출하여 파일을 업로드합니다. 멀티파트 업로드를 실행하여 assetIdentifier와 파일 콘텐츠를 모두 동일한 요청의 일부로 전달합니다. 성공하면 CreativeAsset 리소스가 반환되며, 이 애셋을 광고 소재에 할당하는 데 사용할 assetIdentifier이 표시됩니다.

    # Upload the asset.
    mime_type = determine_mime_type(path_to_asset_file, asset_type)
    
    result = @service.insert_creative_asset(
      @profile_id,
      advertiser_id,
      creative_asset,
      content_type: mime_type,
      upload_source: path_to_asset_file
    )
    

광고 소재 만들기

Creative 객체는 기존 애셋을 래핑합니다. 호스트 페이지에서 광고 소재를 사용할 방법에 따라 다양한 광고 소재 유형의 Creative 객체를 만들 수 있습니다. 참조 문서에서 적합한 유형을 확인하세요.

다음 예는 새 HTML5 디스플레이 소재를 만드는 방법을 보여줍니다.

C#

  1. 애셋을 업로드합니다. 광고 소재마다 필요한 애셋 유형과 수량이 다릅니다. 자세한 내용은 애셋 업로드를 참조하세요. 애셋을 업로드할 때마다 응답에 assetIdenfitier가 표시됩니다. 저장된 파일 이름과 유형을 사용하여 기존 ID가 아닌 광고 소재에서 이러한 애셋을 참조합니다.
  2. 광고 소재를 만들고 적절한 값을 할당합니다. Creative를 인스턴스화하고 적절한 type를 설정합니다. Creative 객체의 유형을 저장한 후에는 변경할 수 없습니다. AssetIdentifierrole로 애셋을 지정합니다.
    // Locate an advertiser landing page to use as a default.
    LandingPage defaultLandingPage = getAdvertiserLandingPage(service, profileId, advertiserId);
    
    // Create the creative structure.
    Creative creative = new Creative();
    creative.AdvertiserId = advertiserId;
    creative.Name = "Test HTML5 display creative";
    creative.Size = new Size() { Id = sizeId };
    creative.Type = "DISPLAY";
    
    // Upload the HTML5 asset.
    CreativeAssetUtils assetUtils = new CreativeAssetUtils(service, profileId, advertiserId);
    CreativeAssetId html5AssetId =
        assetUtils.uploadAsset(pathToHtml5AssetFile, "HTML").AssetIdentifier;
    
    CreativeAsset html5Asset = new CreativeAsset();
    html5Asset.AssetIdentifier = html5AssetId;
    html5Asset.Role = "PRIMARY";
    
    // Upload the backup image asset.
    CreativeAssetId imageAssetId =
        assetUtils.uploadAsset(pathToImageAssetFile, "HTML_IMAGE").AssetIdentifier;
    
    CreativeAsset imageAsset = new CreativeAsset();
    imageAsset.AssetIdentifier = imageAssetId;
    imageAsset.Role = "BACKUP_IMAGE";
    
    // Add the creative assets.
    creative.CreativeAssets = new List<CreativeAsset>() { html5Asset, imageAsset };
    
    // Configure the bacup image.
    creative.BackupImageClickThroughUrl = new CreativeClickThroughUrl() {
      LandingPageId = defaultLandingPage.Id
    };
    creative.BackupImageReportingLabel = "backup";
    creative.BackupImageTargetWindow = new TargetWindow() { TargetWindowOption = "NEW_WINDOW" };
    
    // Add a click tag.
    ClickTag clickTag = new ClickTag();
    clickTag.Name = "clickTag";
    clickTag.EventName = "exit";
    clickTag.ClickThroughUrl = new CreativeClickThroughUrl() {
      LandingPageId = defaultLandingPage.Id
    };
    creative.ClickTags = new List<ClickTag>() { clickTag };
    
  3. 광고 소재를 저장합니다. creatives.insert()을 호출하면 됩니다. 이 광고 소재와 연결할 광고주 ID를 지정해야 합니다.
    Creative result = service.Creatives.Insert(creative, profileId).Execute();
    
  4. (선택사항) 광고 소재를 캠페인과 연결합니다. campaignCreativeAssociations.insert()를 호출하고 캠페인 및 광고 소재 ID를 전달하면 됩니다.
    // Create the campaign creative association structure.
    CampaignCreativeAssociation association = new CampaignCreativeAssociation();
    association.CreativeId = creativeId;
    
    // Insert the association.
    CampaignCreativeAssociation result =
        service.CampaignCreativeAssociations.Insert(association, profileId, campaignId).Execute();
    

Java

  1. 애셋을 업로드합니다. 광고 소재마다 필요한 애셋 유형과 수량이 다릅니다. 자세한 내용은 애셋 업로드를 참조하세요. 애셋을 업로드할 때마다 응답에 assetIdenfitier가 표시됩니다. 저장된 파일 이름과 유형을 사용하여 기존 ID가 아닌 광고 소재에서 이러한 애셋을 참조합니다.
  2. 광고 소재를 만들고 적절한 값을 할당합니다. Creative를 인스턴스화하고 적절한 type를 설정합니다. Creative 객체의 유형을 저장한 후에는 변경할 수 없습니다. AssetIdentifierrole로 애셋을 지정합니다.
    // Locate an advertiser landing page to use as a default.
    LandingPage defaultLandingPage = getAdvertiserLandingPage(reporting, profileId, advertiserId);
    
    // Create the creative structure.
    Creative creative = new Creative();
    creative.setAdvertiserId(advertiserId);
    creative.setName("Test HTML5 display creative");
    creative.setSize(new Size().setId(sizeId));
    creative.setType("DISPLAY");
    
    // Upload the HTML5 asset.
    CreativeAssetId html5AssetId = CreativeAssetUtils.uploadAsset(reporting, profileId,
        advertiserId, HTML5_ASSET_NAME, PATH_TO_HTML5_ASSET_FILE, "HTML").getAssetIdentifier();
    
    CreativeAsset html5Asset =
        new CreativeAsset().setAssetIdentifier(html5AssetId).setRole("PRIMARY");
    
    // Upload the backup image asset (note: asset type must be set to HTML_IMAGE).
    CreativeAssetId imageAssetId = CreativeAssetUtils.uploadAsset(reporting, profileId,
        advertiserId, IMAGE_ASSET_NAME, PATH_TO_IMAGE_ASSET_FILE, "HTML_IMAGE")
        .getAssetIdentifier();
    
    CreativeAsset backupImageAsset =
        new CreativeAsset().setAssetIdentifier(imageAssetId).setRole("BACKUP_IMAGE");
    
    // Add the creative assets.
    creative.setCreativeAssets(ImmutableList.of(html5Asset, backupImageAsset));
    
    // Configure the backup image.
    creative.setBackupImageClickThroughUrl(
        new CreativeClickThroughUrl().setLandingPageId(defaultLandingPage.getId()));
    creative.setBackupImageReportingLabel("backup");
    creative.setBackupImageTargetWindow(new TargetWindow().setTargetWindowOption("NEW_WINDOW"));
    
    // Add a click tag.
    ClickTag clickTag =
        new ClickTag().setName("clickTag").setEventName("exit").setClickThroughUrl(
            new CreativeClickThroughUrl().setLandingPageId(defaultLandingPage.getId()));
    creative.setClickTags(ImmutableList.of(clickTag));
    
  3. 광고 소재를 저장합니다. creatives.insert()을 호출하면 됩니다. 이 광고 소재와 연결할 광고주 ID를 지정해야 합니다.
    Creative result = reporting.creatives().insert(profileId, creative).execute();
    
  4. (선택사항) 광고 소재를 캠페인과 연결합니다. campaignCreativeAssociations.insert()를 호출하고 캠페인 및 광고 소재 ID를 전달하면 됩니다.
    // Create the campaign creative association structure.
    CampaignCreativeAssociation association = new CampaignCreativeAssociation();
    association.setCreativeId(creativeId);
    
    // Insert the association.
    CampaignCreativeAssociation result = reporting
        .campaignCreativeAssociations().insert(profileId, campaignId, association)
        .execute();
    

2,399필리핀

  1. 애셋을 업로드합니다. 광고 소재마다 필요한 애셋 유형과 수량이 다릅니다. 자세한 내용은 애셋 업로드를 참조하세요. 애셋을 업로드할 때마다 응답에 assetIdenfitier가 표시됩니다. 저장된 파일 이름과 유형을 사용하여 기존 ID가 아닌 광고 소재에서 이러한 애셋을 참조합니다.
  2. 광고 소재를 만들고 적절한 값을 할당합니다. Creative를 인스턴스화하고 적절한 type를 설정합니다. Creative 객체의 유형을 저장한 후에는 변경할 수 없습니다. AssetIdentifierrole로 애셋을 지정합니다.
    $creative = new Google_Service_Dfareporting_Creative();
    $creative->setAdvertiserId($values['advertiser_id']);
    $creative->setAutoAdvanceImages(true);
    $creative->setName('Test HTML5 display creative');
    $creative->setType('DISPLAY');
    
    $size = new Google_Service_Dfareporting_Size();
    $size->setId($values['size_id']);
    $creative->setSize($size);
    
    // Upload the HTML5 asset.
    $html = uploadAsset(
        $this->service,
        $values['user_profile_id'],
        $values['advertiser_id'],
        $values['html_asset_file'],
        'HTML'
    );
    
    $htmlAsset = new Google_Service_Dfareporting_CreativeAsset();
    $htmlAsset->setAssetIdentifier($html->getAssetIdentifier());
    $htmlAsset->setRole('PRIMARY');
    
    // Upload the backup image asset.
    $image = uploadAsset(
        $this->service,
        $values['user_profile_id'],
        $values['advertiser_id'],
        $values['image_asset_file'],
        'HTML_IMAGE'
    );
    
    $imageAsset = new Google_Service_Dfareporting_CreativeAsset();
    $imageAsset->setAssetIdentifier($image->getAssetIdentifier());
    $imageAsset->setRole('BACKUP_IMAGE');
    
    // Add the creative assets.
    $creative->setCreativeAssets([$htmlAsset, $imageAsset]);
    
    // Configure the default click-through URL.
    $clickThroughUrl =
        new Google_Service_Dfareporting_CreativeClickThroughUrl();
    $clickThroughUrl->setLandingPageId($values['landing_page_id']);
    
    // Configure the backup image.
    $creative->setBackupImageClickThroughUrl($clickThroughUrl);
    $creative->setBackupImageReportingLabel('backup');
    
    $targetWindow = new Google_Service_Dfareporting_TargetWindow();
    $targetWindow->setTargetWindowOption('NEW_WINDOW');
    $creative->setBackupImageTargetWindow($targetWindow);
    
    // Add a click tag.
    $clickTag = new Google_Service_Dfareporting_ClickTag();
    $clickTag->setName('clickTag');
    $clickTag->setEventName('exit');
    $clickTag->setClickThroughUrl($clickThroughUrl);
    $creative->setClickTags([$clickTag]);
    
  3. 광고 소재를 저장합니다. creatives.insert()을 호출하면 됩니다. 이 광고 소재와 연결할 광고주 ID를 지정해야 합니다.
    $result = $this->service->creatives->insert(
        $values['user_profile_id'],
        $creative
    );
    
  4. (선택사항) 광고 소재를 캠페인과 연결합니다. campaignCreativeAssociations.insert()를 호출하고 캠페인 및 광고 소재 ID를 전달하면 됩니다.
    $association =
        new Google_Service_Dfareporting_CampaignCreativeAssociation();
    $association->setCreativeId($values['creative_id']);
    
    $result = $this->service->campaignCreativeAssociations->insert(
        $values['user_profile_id'],
        $values['campaign_id'],
        $association
    );
    

Python

  1. 애셋을 업로드합니다. 광고 소재마다 필요한 애셋 유형과 수량이 다릅니다. 자세한 내용은 애셋 업로드를 참조하세요. 애셋을 업로드할 때마다 응답에 assetIdenfitier가 표시됩니다. 저장된 파일 이름과 유형을 사용하여 기존 ID가 아닌 광고 소재에서 이러한 애셋을 참조합니다.
  2. 광고 소재를 만들고 적절한 값을 할당합니다. Creative를 인스턴스화하고 적절한 type를 설정합니다. Creative 객체의 유형을 저장한 후에는 변경할 수 없습니다. AssetIdentifierrole로 애셋을 지정합니다.
    # Locate an advertiser landing page to use as a default.
    default_landing_page = get_advertiser_landing_page(service, profile_id,
                                                       advertiser_id)
    
    # Upload the HTML5 asset
    html5_asset_id = upload_creative_asset(service, profile_id, advertiser_id,
                                           html5_asset_name,
                                           path_to_html5_asset_file, 'HTML')
    
    # Upload the backup image asset
    backup_image_asset_id = upload_creative_asset(
        service, profile_id, advertiser_id, backup_image_name,
        path_to_backup_image_file, 'HTML_IMAGE')
    
    # Construct the creative structure.
    creative = {
        'advertiserId': advertiser_id,
        'backupImageClickThroughUrl': {
            'landingPageId': default_landing_page['id']
        },
        'backupImageReportingLabel': 'backup_image_exit',
        'backupImageTargetWindow': {'targetWindowOption': 'NEW_WINDOW'},
        'clickTags': [{
            'eventName': 'exit',
            'name': 'click_tag',
            'clickThroughUrl': {'landingPageId': default_landing_page['id']}
        }],
        'creativeAssets': [
            {'assetIdentifier': html5_asset_id, 'role': 'PRIMARY'},
            {'assetIdentifier': backup_image_asset_id, 'role': 'BACKUP_IMAGE'}
        ],
        'name': 'Test HTML5 display creative',
        'size': {'id': size_id},
        'type': 'DISPLAY'
    }
    
  3. 광고 소재를 저장합니다. creatives.insert()을 호출하면 됩니다. 이 광고 소재와 연결할 광고주 ID를 지정해야 합니다.
    request = service.creatives().insert(profileId=profile_id, body=creative)
    
    # Execute request and print response.
    response = request.execute()
    
  4. (선택사항) 광고 소재를 캠페인과 연결합니다. campaignCreativeAssociations.insert()를 호출하고 캠페인 및 광고 소재 ID를 전달하면 됩니다.
    # Construct the request.
    association = {
        'creativeId': creative_id
    }
    
    request = service.campaignCreativeAssociations().insert(
        profileId=profile_id, campaignId=campaign_id, body=association)
    
    # Execute request and print response.
    response = request.execute()
    

Ruby

  1. 애셋을 업로드합니다. 광고 소재마다 필요한 애셋 유형과 수량이 다릅니다. 자세한 내용은 애셋 업로드를 참조하세요. 애셋을 업로드할 때마다 응답에 assetIdenfitier가 표시됩니다. 저장된 파일 이름과 유형을 사용하여 기존 ID가 아닌 광고 소재에서 이러한 애셋을 참조합니다.
  2. 광고 소재를 만들고 적절한 값을 할당합니다. Creative를 인스턴스화하고 적절한 type를 설정합니다. Creative 객체의 유형을 저장한 후에는 변경할 수 없습니다. AssetIdentifierrole로 애셋을 지정합니다.
    # Locate an advertiser landing page to use as a default.
    default_landing_page = get_advertiser_landing_page(service, profile_id,
      advertiser_id)
    
    # Upload the HTML5 asset.
    html5_asset_id = util.upload_asset(advertiser_id, path_to_html5_asset_file,
      'HTML').asset_identifier
    
    # Upload the backup image asset.
    backup_image_asset_id = util.upload_asset(advertiser_id,
      path_to_backup_image_file, 'HTML_IMAGE').asset_identifier
    
    # Construct the creative structure.
    creative = DfareportingUtils::API_NAMESPACE::Creative.new(
      advertiser_id: advertiser_id,
      backup_image_click_through_url:
        DfareportingUtils::API_NAMESPACE::CreativeClickThroughUrl.new(
          landing_page_id: default_landing_page.id
        ),
      backup_image_reporting_label: 'backup',
      backup_image_target_window:
        DfareportingUtils::API_NAMESPACE::TargetWindow.new(
          target_window_option: 'NEW_WINDOW'
        ),
      click_tags: [
        DfareportingUtils::API_NAMESPACE::ClickTag.new(
          event_name: 'exit',
          name: 'click_tag',
          click_through_url:
            DfareportingUtils::API_NAMESPACE::CreativeClickThroughUrl.new(
              landing_page_id: default_landing_page.id
            )
        )
      ],
      creative_assets: [
        DfareportingUtils::API_NAMESPACE::CreativeAsset.new(
          asset_identifier: html5_asset_id,
          role: 'PRIMARY'
        ),
        DfareportingUtils::API_NAMESPACE::CreativeAsset.new(
          asset_identifier: backup_image_asset_id,
          role: 'BACKUP_IMAGE'
        )
      ],
      name: 'Example HTML5 display creative',
      size: DfareportingUtils::API_NAMESPACE::Size.new(id: size_id),
      type: 'DISPLAY'
    )
    
  3. 광고 소재를 저장합니다. creatives.insert()을 호출하면 됩니다. 이 광고 소재와 연결할 광고주 ID를 지정해야 합니다.
    # Insert the creative.
    result = service.insert_creative(profile_id, creative)
    
  4. (선택사항) 광고 소재를 캠페인과 연결합니다. campaignCreativeAssociations.insert()를 호출하고 캠페인 및 광고 소재 ID를 전달하면 됩니다.
    # Create a new creative-campaign association to insert
    association =
      DfareportingUtils::API_NAMESPACE::CampaignCreativeAssociation.new(
        creative_id: creative_id
      )
    
    # Insert the advertiser group.
    result = service.insert_campaign_creative_association(profile_id, campaign_id,
      association)
    

광고 작성

AdCreativePlacement 간의 연결입니다. Ad은 하나 이상의 게재위치에 연결할 수 있으며 하나 이상의 광고 소재를 보유할 수 있습니다.

Ad를 명시적으로 또는 암시적으로 만들 수 있습니다.

명시적으로

C#

  1. 이 광고가 연결되어야 하는 각 광고 소재에 대한 CreativeAssignment 객체를 만듭니다. CreativeAssignment.active 필드를 true로 설정해야 합니다.
    // Create a click-through URL.
    ClickThroughUrl clickThroughUrl = new ClickThroughUrl();
    clickThroughUrl.DefaultLandingPage = true;
    
    // Create a creative assignment.
    CreativeAssignment creativeAssignment = new CreativeAssignment();
    creativeAssignment.Active = true;
    creativeAssignment.CreativeId = creativeId;
    creativeAssignment.ClickThroughUrl = clickThroughUrl;
    
  2. CreativeAssignment를 저장할 CreativeRotation 객체를 만듭니다. 순환게재 그룹을 만드는 경우 다른 필수 광고 소재 순환게재 입력란을 설정해야 합니다.
    // Create a creative rotation.
    CreativeRotation creativeRotation = new CreativeRotation();
    creativeRotation.CreativeAssignments = new List<CreativeAssignment>() {
        creativeAssignment
    };
    
  3. 이 광고가 연결되어야 하는 각 게재위치의 PlacementAssignment 객체를 만듭니다. PlacementAssignment.active 필드를 true로 설정해야 합니다.
    // Create a placement assignment.
    PlacementAssignment placementAssignment = new PlacementAssignment();
    placementAssignment.Active = true;
    placementAssignment.PlacementId = placementId;
    
  4. Ad객체 만들기 광고 소재 순환게재를 Ad 객체의 creativeRotation 입력란으로, 게재위치 할당을 Ad 객체의 placementAssignments 배열로 설정합니다.
    // Create a delivery schedule.
    DeliverySchedule deliverySchedule = new DeliverySchedule();
    deliverySchedule.ImpressionRatio = 1;
    deliverySchedule.Priority = "AD_PRIORITY_01";
    
    DateTime startDate = DateTime.Now;
    DateTime endDate = Convert.ToDateTime(campaign.EndDate);
    
    // Create a rotation group.
    Ad rotationGroup = new Ad();
    rotationGroup.Active = true;
    rotationGroup.CampaignId = campaignId;
    rotationGroup.CreativeRotation = creativeRotation;
    rotationGroup.DeliverySchedule = deliverySchedule;
    rotationGroup.StartTime = startDate;
    rotationGroup.EndTime = endDate;
    rotationGroup.Name = adName;
    rotationGroup.PlacementAssignments = new List<PlacementAssignment>() {
        placementAssignment
    };
    rotationGroup.Type = "AD_SERVING_STANDARD_AD";
    
  5. ads.insert()를 호출하여 광고를 저장합니다.
    // Insert the rotation group.
    Ad result = service.Ads.Insert(rotationGroup, profileId).Execute();
    

Java

  1. 이 광고가 연결되어야 하는 각 광고 소재에 대한 CreativeAssignment 객체를 만듭니다. CreativeAssignment.active 필드를 true로 설정해야 합니다.
    // Create a click-through URL.
    ClickThroughUrl clickThroughUrl = new ClickThroughUrl();
    clickThroughUrl.setDefaultLandingPage(true);
    
    // Create a creative assignment.
    CreativeAssignment creativeAssignment = new CreativeAssignment();
    creativeAssignment.setActive(true);
    creativeAssignment.setCreativeId(creativeId);
    creativeAssignment.setClickThroughUrl(clickThroughUrl);
    
  2. CreativeAssignment를 저장할 CreativeRotation 객체를 만듭니다. 순환게재 그룹을 만드는 경우 다른 필수 광고 소재 순환게재 입력란을 설정해야 합니다.
    // Create a creative rotation.
    CreativeRotation creativeRotation = new CreativeRotation();
    creativeRotation.setCreativeAssignments(ImmutableList.of(creativeAssignment));
    
  3. 이 광고가 연결되어야 하는 각 게재위치의 PlacementAssignment 객체를 만듭니다. PlacementAssignment.active 필드를 true로 설정해야 합니다.
    // Create a placement assignment.
    PlacementAssignment placementAssignment = new PlacementAssignment();
    placementAssignment.setActive(true);
    placementAssignment.setPlacementId(placementId);
    
  4. Ad객체 만들기 광고 소재 순환게재를 Ad 객체의 creativeRotation 입력란으로, 게재위치 할당을 Ad 객체의 placementAssignments 배열로 설정합니다.
    // Create a delivery schedule.
    DeliverySchedule deliverySchedule = new DeliverySchedule();
    deliverySchedule.setImpressionRatio(1L);
    deliverySchedule.setPriority("AD_PRIORITY_01");
    
    DateTime startDate = new DateTime(new Date());
    DateTime endDate = new DateTime(campaign.getEndDate().getValue());
    
    // Create a rotation group.
    Ad rotationGroup = new Ad();
    rotationGroup.setActive(true);
    rotationGroup.setCampaignId(campaignId);
    rotationGroup.setCreativeRotation(creativeRotation);
    rotationGroup.setDeliverySchedule(deliverySchedule);
    rotationGroup.setStartTime(startDate);
    rotationGroup.setEndTime(endDate);
    rotationGroup.setName(adName);
    rotationGroup.setPlacementAssignments(ImmutableList.of(placementAssignment));
    rotationGroup.setType("AD_SERVING_STANDARD_AD");
    
  5. ads.insert()를 호출하여 광고를 저장합니다.
    // Insert the rotation group.
    Ad result = reporting.ads().insert(profileId, rotationGroup).execute();
    

2,399필리핀

  1. 이 광고가 연결되어야 하는 각 광고 소재에 대한 CreativeAssignment 객체를 만듭니다. CreativeAssignment.active 필드를 true로 설정해야 합니다.
    // Create a click-through URL.
    $url = new Google_Service_Dfareporting_ClickThroughUrl();
    $url->setDefaultLandingPage(true);
    
    // Create a creative assignment.
    $creativeAssignment =
        new Google_Service_Dfareporting_CreativeAssignment();
    $creativeAssignment->setActive(true);
    $creativeAssignment->setCreativeId($values['creative_id']);
    $creativeAssignment->setClickThroughUrl($url);
    
  2. CreativeAssignment를 저장할 CreativeRotation 객체를 만듭니다. 순환게재 그룹을 만드는 경우 다른 필수 광고 소재 순환게재 입력란을 설정해야 합니다.
    // Create a creative rotation.
    $creativeRotation = new Google_Service_Dfareporting_CreativeRotation();
    $creativeRotation->setCreativeAssignments([$creativeAssignment]);
    
  3. 이 광고가 연결되어야 하는 각 게재위치의 PlacementAssignment 객체를 만듭니다. PlacementAssignment.active 필드를 true로 설정해야 합니다.
    // Create a placement assignment.
    $placementAssignment =
        new Google_Service_Dfareporting_PlacementAssignment();
    $placementAssignment->setActive(true);
    $placementAssignment->setPlacementId($values['placement_id']);
    
  4. Ad객체 만들기 광고 소재 순환게재를 Ad 객체의 creativeRotation 입력란으로, 게재위치 할당을 Ad 객체의 placementAssignments 배열로 설정합니다.
    // Create a delivery schedule.
    $deliverySchedule = new Google_Service_Dfareporting_DeliverySchedule();
    $deliverySchedule->setImpressionRatio(1);
    $deliverySchedule->SetPriority('AD_PRIORITY_01');
    
    $startDate = new DateTime('today');
    $endDate = new DateTime($campaign->getEndDate());
    
    // Create a rotation group.
    $ad = new Google_Service_Dfareporting_Ad();
    $ad->setActive(true);
    $ad->setCampaignId($values['campaign_id']);
    $ad->setCreativeRotation($creativeRotation);
    $ad->setDeliverySchedule($deliverySchedule);
    $ad->setStartTime($startDate->format('Y-m-d') . 'T23:59:59Z');
    $ad->setEndTime($endDate->format('Y-m-d') . 'T00:00:00Z');
    $ad->setName($values['ad_name']);
    $ad->setPlacementAssignments([$placementAssignment]);
    $ad->setType('AD_SERVING_STANDARD_AD');
    
  5. ads.insert()를 호출하여 광고를 저장합니다.
    $result = $this->service->ads->insert($values['user_profile_id'], $ad);
    

Python

  1. 이 광고가 연결되어야 하는 각 광고 소재에 대한 CreativeAssignment 객체를 만듭니다. CreativeAssignment.active 필드를 true로 설정해야 합니다.
    # Construct creative assignment.
    creative_assignment = {
        'active': 'true',
        'creativeId': creative_id,
        'clickThroughUrl': {
            'defaultLandingPage': 'true'
        }
    }
    
  2. CreativeAssignment를 저장할 CreativeRotation 객체를 만듭니다. 순환게재 그룹을 만드는 경우 다른 필수 광고 소재 순환게재 입력란을 설정해야 합니다.
    # Construct creative rotation.
    creative_rotation = {
        'creativeAssignments': [creative_assignment],
        'type': 'CREATIVE_ROTATION_TYPE_RANDOM',
        'weightCalculationStrategy': 'WEIGHT_STRATEGY_OPTIMIZED'
    }
    
  3. 이 광고가 연결되어야 하는 각 게재위치의 PlacementAssignment 객체를 만듭니다. PlacementAssignment.active 필드를 true로 설정해야 합니다.
    # Construct placement assignment.
    placement_assignment = {
        'active': 'true',
        'placementId': placement_id,
    }
    
  4. Ad객체 만들기 광고 소재 순환게재를 Ad 객체의 creativeRotation 입력란으로, 게재위치 할당을 Ad 객체의 placementAssignments 배열로 설정합니다.
    # Construct delivery schedule.
    delivery_schedule = {
        'impressionRatio': '1',
        'priority': 'AD_PRIORITY_01'
    }
    
    # Construct and save ad.
    ad = {
        'active': 'true',
        'campaignId': campaign_id,
        'creativeRotation': creative_rotation,
        'deliverySchedule': delivery_schedule,
        'endTime': '%sT00:00:00Z' % campaign['endDate'],
        'name': 'Test Rotation Group',
        'placementAssignments': [placement_assignment],
        'startTime': '%sT23:59:59Z' % time.strftime('%Y-%m-%d'),
        'type': 'AD_SERVING_STANDARD_AD'
    }
    
  5. ads.insert()를 호출하여 광고를 저장합니다.
    request = service.ads().insert(profileId=profile_id, body=ad)
    
    # Execute request and print response.
    response = request.execute()
    

Ruby

  1. 이 광고가 연결되어야 하는 각 광고 소재에 대한 CreativeAssignment 객체를 만듭니다. CreativeAssignment.active 필드를 true로 설정해야 합니다.
    # Construct creative assignment.
    creative_assignment =
      DfareportingUtils::API_NAMESPACE::CreativeAssignment.new(
        active: true,
        creative_id: creative_id,
        click_through_url: DfareportingUtils::API_NAMESPACE::ClickThroughUrl.new(
          default_landing_page: true
        )
      )
    
  2. CreativeAssignment를 저장할 CreativeRotation 객체를 만듭니다. 순환게재 그룹을 만드는 경우 다른 필수 광고 소재 순환게재 입력란을 설정해야 합니다.
    # Construct creative rotation.
    creative_rotation = DfareportingUtils::API_NAMESPACE::CreativeRotation.new(
      creative_assignments: [creative_assignment],
      type: 'CREATIVE_ROTATION_TYPE_RANDOM',
      weight_calculation_strategy: 'WEIGHT_STRATEGY_OPTIMIZED'
    )
    
  3. 이 광고가 연결되어야 하는 각 게재위치의 PlacementAssignment 객체를 만듭니다. PlacementAssignment.active 필드를 true로 설정해야 합니다.
    # Construct placement assignment.
    placement_assignment =
      DfareportingUtils::API_NAMESPACE::PlacementAssignment.new(
        active: true,
        placement_id: placement_id
      )
    
  4. Ad객체 만들기 광고 소재 순환게재를 Ad 객체의 creativeRotation 입력란으로, 게재위치 할당을 Ad 객체의 placementAssignments 배열로 설정합니다.
    # Construct delivery schedule.
    delivery_schedule = DfareportingUtils::API_NAMESPACE::DeliverySchedule.new(
      impression_ratio: 1,
      priority: 'AD_PRIORITY_01'
    )
    
    # Construct and save ad.
    ad = DfareportingUtils::API_NAMESPACE::Ad.new(
      active: true,
      campaign_id: campaign_id,
      creative_rotation: creative_rotation,
      delivery_schedule: delivery_schedule,
      end_time: format('%sT00:00:00Z', campaign.end_date),
      name: 'Example Rotation Group',
      placement_assignments: [placement_assignment],
      start_time: format('%sT23:59:59Z', Time.now.strftime('%Y-%m-%d')),
      type: 'AD_SERVING_STANDARD_AD'
    )
    
  5. ads.insert()를 호출하여 광고를 저장합니다.
    result = service.insert_ad(profile_id, ad)
    

암시적

C#

  1. Placement를 만들고 저장합니다.
  2. Creative를 만들고 저장합니다.
  3. campaignCreativeAssociations.insert()를 호출하여 CreativePlacement에 사용된 동일한 Campaign와 연결합니다 (광고 소재 만들기 섹션의 4단계 참조). 이렇게 하면 광고 소재와 게재위치에 연결된 기본 광고가 생성됩니다.
    // Create the campaign creative association structure.
    CampaignCreativeAssociation association = new CampaignCreativeAssociation();
    association.CreativeId = creativeId;
    
    // Insert the association.
    CampaignCreativeAssociation result =
        service.CampaignCreativeAssociations.Insert(association, profileId, campaignId).Execute();
    

Java

  1. Placement를 만들고 저장합니다.
  2. Creative를 만들고 저장합니다.
  3. campaignCreativeAssociations.insert()를 호출하여 CreativePlacement에 사용된 동일한 Campaign와 연결합니다 (광고 소재 만들기 섹션의 4단계 참조). 이렇게 하면 광고 소재와 게재위치에 연결된 기본 광고가 생성됩니다.
    // Create the campaign creative association structure.
    CampaignCreativeAssociation association = new CampaignCreativeAssociation();
    association.setCreativeId(creativeId);
    
    // Insert the association.
    CampaignCreativeAssociation result = reporting
        .campaignCreativeAssociations().insert(profileId, campaignId, association)
        .execute();
    

2,399필리핀

  1. Placement를 만들고 저장합니다.
  2. Creative를 만들고 저장합니다.
  3. campaignCreativeAssociations.insert()를 호출하여 CreativePlacement에 사용된 동일한 Campaign와 연결합니다 (광고 소재 만들기 섹션의 4단계 참조). 이렇게 하면 광고 소재와 게재위치에 연결된 기본 광고가 생성됩니다.
    $association =
        new Google_Service_Dfareporting_CampaignCreativeAssociation();
    $association->setCreativeId($values['creative_id']);
    
    $result = $this->service->campaignCreativeAssociations->insert(
        $values['user_profile_id'],
        $values['campaign_id'],
        $association
    );
    

Python

  1. Placement를 만들고 저장합니다.
  2. Creative를 만들고 저장합니다.
  3. campaignCreativeAssociations.insert()를 호출하여 CreativePlacement에 사용된 동일한 Campaign와 연결합니다 (광고 소재 만들기 섹션의 4단계 참조). 이렇게 하면 광고 소재와 게재위치에 연결된 기본 광고가 생성됩니다.
    # Construct the request.
    association = {
        'creativeId': creative_id
    }
    
    request = service.campaignCreativeAssociations().insert(
        profileId=profile_id, campaignId=campaign_id, body=association)
    
    # Execute request and print response.
    response = request.execute()
    

Ruby

  1. Placement를 만들고 저장합니다.
  2. Creative를 만들고 저장합니다.
  3. campaignCreativeAssociations.insert()를 호출하여 CreativePlacement에 사용된 동일한 Campaign와 연결합니다 (광고 소재 만들기 섹션의 4단계 참조). 이렇게 하면 광고 소재와 게재위치에 연결된 기본 광고가 생성됩니다.
    # Create a new creative-campaign association to insert
    association =
      DfareportingUtils::API_NAMESPACE::CampaignCreativeAssociation.new(
        creative_id: creative_id
      )
    
    # Insert the advertiser group.
    result = service.insert_campaign_creative_association(profile_id, campaign_id,
      association)
    

암시적으로 광고를 만들면 Ad를 만드는 추가 단계를 생략할 수 있습니다. 이 작업은 캠페인에 지정된 크기의 기본 광고가 없는 경우에만 수행할 수 있습니다.

객체 검색

찾을 객체를 정의하는 서비스에서 노출한 list() 작업을 호출하고 해당 객체 유형에 적합한 선택적 기준을 지정하여 객체를 검색할 수 있습니다. 예를 들어 광고 객체를 검색하려면 ads.list()를 호출합니다. 선택적 기준은 해당 객체에 적합한 속성 집합을 표시합니다. 속성을 검색할 수 있는 만큼 입력하세요. 검색에서는 기준을 모두 충족하는 개체만 반환합니다. 기준과 일치하는 검색은 수행할 수 없습니다. 문자열은 * 와일드 카드를 지원하고 대소문자를 구분하지 않으며, 더 큰 문자열 내에서 일치하는 항목을 찾습니다.

성능 향상을 위해 fields 매개변수를 사용하여 부분 응답을 요청할 수 있습니다. 이렇게 하면 서버에서 전체 리소스 표현이 아닌 지정한 필드만 반환하도록 지시합니다. 이 주제에 관한 자세한 내용은 성능 도움말 가이드에서 확인할 수 있습니다.

Paging

경우에 따라 list() 요청의 모든 결과를 검색하는 것이 바람직하지 않을 수 있습니다. 예를 들어 수천 개의 광고 중에서 10개의 최신 광고에만 관심이 있을 수 있습니다. 이를 위해 다수의 list() 메서드를 사용하면 페이징이라고 하는 프로세스를 통해 더 적은 결과를 요청할 수 있습니다.

페이징을 지원하는 메서드는 페이지라는 그룹에서 결과의 하위 집합을 반환합니다. 페이지당 최대 결과 수는 1,000개입니다 (기본값). maxResults를 설정하여 페이지당 결과 수를 변경할 수 있으며 응답에서 반환된 nextPageToken를 사용하여 페이지를 반복할 수 있습니다.

C#

// Limit the fields returned.
String fields = "nextPageToken,ads(advertiserId,id,name)";

AdsListResponse result;
String nextPageToken = null;

do {
  // Create and execute the ad list request.
  AdsResource.ListRequest request = service.Ads.List(profileId);
  request.Active = true;
  request.Fields = fields;
  request.PageToken = nextPageToken;
  result = request.Execute();

  foreach (Ad ad in result.Ads) {
    Console.WriteLine(
        "Ad with ID {0} and name \"{1}\" is associated with advertiser" +
        " ID {2}.", ad.Id, ad.Name, ad.AdvertiserId);
  }

  // Update the next page token.
  nextPageToken = result.NextPageToken;
} while (result.Ads.Any() && !String.IsNullOrEmpty(nextPageToken));

Java

// Limit the fields returned.
String fields = "nextPageToken,ads(advertiserId,id,name)";

AdsListResponse result;
String nextPageToken = null;

do {
  // Create and execute the ad list request.
  result = reporting.ads().list(profileId).setActive(true).setFields(fields)
      .setPageToken(nextPageToken).execute();

  for (Ad ad : result.getAds()) {
    System.out.printf(
        "Ad with ID %d and name \"%s\" is associated with advertiser ID %d.%n", ad.getId(),
        ad.getName(), ad.getAdvertiserId());
  }

  // Update the next page token.
  nextPageToken = result.getNextPageToken();
} while (!result.getAds().isEmpty() && !Strings.isNullOrEmpty(nextPageToken));

2,399필리핀

$response = null;
$pageToken = null;

do {
    // Create and execute the ads list request.
    $response = $this->service->ads->listAds(
        $values['user_profile_id'],
        ['active' => true, 'pageToken' => $pageToken]
    );

    foreach ($response->getAds() as $ads) {
        $this->printResultsTableRow($ads);
    }

    // Update the next page token.
    $pageToken = $response->getNextPageToken();
} while (!empty($response->getAds()) && !empty($pageToken));

Python

# Construct the request.
request = service.ads().list(profileId=profile_id, active=True)

while True:
  # Execute request and print response.
  response = request.execute()

  for ad in response['ads']:
    print 'Found ad with ID %s and name "%s".' % (ad['id'], ad['name'])

  if response['ads'] and response['nextPageToken']:
    request = service.ads().list_next(request, response)
  else:
    break

Ruby

token = nil
loop do
  result = service.list_ads(profile_id,
    page_token: token,
    fields: 'nextPageToken,ads(id,name)')

  # Display results.
  if result.ads.any?
    result.ads.each do |ad|
      puts format('Found ad with ID %d and name "%s".', ad.id, ad.name)
    end

    token = result.next_page_token
  else
    # Stop paging if there are no more results.
    token = nil
  end

  break if token.to_s.empty?
end

플러드라이트 태그 생성

플러드라이트 태그는 페이지에 삽입된 HTML 태그로, 사이트 내에서 사용자 액션 (예: 구매)을 추적하는 데 사용됩니다. 플러드라이트 태그를 생성하려면 FloodlightActivityGroup에 속한 FloodlightActivity가 필요합니다.

C#

  1. 새 플러드라이트 활동 그룹을 만들고 name, type, floodlightConfigurationId 값을 전달합니다.
    // Create the floodlight activity group.
    FloodlightActivityGroup floodlightActivityGroup = new FloodlightActivityGroup();
    floodlightActivityGroup.Name = groupName;
    floodlightActivityGroup.FloodlightConfigurationId = floodlightConfigurationId;
    floodlightActivityGroup.Type = "COUNTER";
    
  2. floodlightActivityGroups.insert()를 호출하여 플러드라이트 활동 그룹을 저장합니다. 그러면 새 그룹의 ID가 반환됩니다.
    // Insert the activity group.
    FloodlightActivityGroup result =
        service.FloodlightActivityGroups.Insert(floodlightActivityGroup, profileId).Execute();
    
  3. 새 플러드라이트 활동을 만들고 방금 만든 플러드라이트 활동 그룹의 ID 및 기타 모든 필수 입력란을 할당합니다.
    // Set floodlight activity structure.
    FloodlightActivity activity = new FloodlightActivity();
    activity.CountingMethod = "STANDARD_COUNTING";
    activity.Name = activityName;
    activity.FloodlightActivityGroupId = activityGroupId;
    activity.FloodlightTagType = "GLOBAL_SITE_TAG";
    activity.ExpectedUrl = url;
    
  4. floodlightActivities.insert()를 호출하여 새 활동을 저장합니다. 그러면 새 활동의 ID가 반환됩니다.
    // Create the floodlight tag activity.
    FloodlightActivity result =
        service.FloodlightActivities.Insert(activity, profileId).Execute();
    
  5. 새 활동의 floodlightActivityIdfloodlightActivities.generatetag()를 호출하여 태그를 생성합니다. 광고주 웹사이트의 웹마스터에게 태그를 전송합니다.
    // Generate the floodlight activity tag.
    FloodlightActivitiesResource.GeneratetagRequest request =
        service.FloodlightActivities.Generatetag(profileId);
    request.FloodlightActivityId = activityId;
    
    FloodlightActivitiesGenerateTagResponse response = request.Execute();
    

Java

  1. 새 플러드라이트 활동 그룹을 만들고 name, type, floodlightConfigurationId 값을 전달합니다.
    // Create the floodlight activity group.
    FloodlightActivityGroup floodlightActivityGroup = new FloodlightActivityGroup();
    floodlightActivityGroup.setName(groupName);
    floodlightActivityGroup.setFloodlightConfigurationId(floodlightConfigurationId);
    floodlightActivityGroup.setType("COUNTER");
    
  2. floodlightActivityGroups.insert()를 호출하여 플러드라이트 활동 그룹을 저장합니다. 그러면 새 그룹의 ID가 반환됩니다.
    // Insert the activity group.
    FloodlightActivityGroup result =
        reporting.floodlightActivityGroups().insert(profileId, floodlightActivityGroup).execute();
    
  3. 새 플러드라이트 활동을 만들고 방금 만든 플러드라이트 활동 그룹의 ID 및 기타 모든 필수 입력란을 할당합니다.
    // Set floodlight activity structure.
    FloodlightActivity activity = new FloodlightActivity();
    activity.setName(activityName);
    activity.setCountingMethod("STANDARD_COUNTING");
    activity.setExpectedUrl(url);
    activity.setFloodlightActivityGroupId(activityGroupId);
    activity.setFloodlightTagType("GLOBAL_SITE_TAG");
    
  4. floodlightActivities.insert()를 호출하여 새 활동을 저장합니다. 그러면 새 활동의 ID가 반환됩니다.
    // Create the floodlight tag activity.
    FloodlightActivity result =
        reporting.floodlightActivities().insert(profileId, activity).execute();
    
  5. 새 활동의 floodlightActivityIdfloodlightActivities.generatetag()를 호출하여 태그를 생성합니다. 광고주 웹사이트의 웹마스터에게 태그를 전송합니다.
    // Generate the floodlight activity tag.
    Generatetag request = reporting.floodlightActivities().generatetag(profileId);
    request.setFloodlightActivityId(activityId);
    
    FloodlightActivitiesGenerateTagResponse response = request.execute();
    

2,399필리핀

  1. 새 플러드라이트 활동 그룹을 만들고 name, type, floodlightConfigurationId 값을 전달합니다.
    $group = new Google_Service_Dfareporting_FloodlightActivityGroup();
    $group->setFloodlightConfigurationId($values['configuration_id']);
    $group->setName($values['group_name']);
    $group->setType('COUNTER');
    
  2. floodlightActivityGroups.insert()를 호출하여 플러드라이트 활동 그룹을 저장합니다. 그러면 새 그룹의 ID가 반환됩니다.
    $result = $this->service->floodlightActivityGroups->insert(
        $values['user_profile_id'],
        $group
    );
    
  3. 새 플러드라이트 활동을 만들고 방금 만든 플러드라이트 활동 그룹의 ID 및 기타 모든 필수 입력란을 할당합니다.
    $activity = new Google_Service_Dfareporting_FloodlightActivity();
    $activity->setCountingMethod('STANDARD_COUNTING');
    $activity->setExpectedUrl($values['url']);
    $activity->setFloodlightActivityGroupId($values['activity_group_id']);
    $activity->setFloodlightTagType('GLOBAL_SITE_TAG');
    $activity->setName($values['activity_name']);
    
  4. floodlightActivities.insert()를 호출하여 새 활동을 저장합니다. 그러면 새 활동의 ID가 반환됩니다.
    $result = $this->service->floodlightActivities->insert(
        $values['user_profile_id'],
        $activity
    );
    
  5. 새 활동의 floodlightActivityIdfloodlightActivities.generatetag()를 호출하여 태그를 생성합니다. 광고주 웹사이트의 웹마스터에게 태그를 전송합니다.
    $result = $this->service->floodlightActivities->generatetag(
        $values['user_profile_id'],
        ['floodlightActivityId' => $values['activity_id']]
    );
    

Python

  1. 새 플러드라이트 활동 그룹을 만들고 name, type, floodlightConfigurationId 값을 전달합니다.
    # Construct and save floodlight activity group.
    activity_group = {
        'name': 'Test Floodlight Activity Group',
        'floodlightConfigurationId': floodlight_config_id,
        'type': 'COUNTER'
    }
    
  2. floodlightActivityGroups.insert()를 호출하여 플러드라이트 활동 그룹을 저장합니다. 그러면 새 그룹의 ID가 반환됩니다.
    request = service.floodlightActivityGroups().insert(
        profileId=profile_id, body=activity_group)
    
  3. 새 플러드라이트 활동을 만들고 방금 만든 플러드라이트 활동 그룹의 ID 및 기타 모든 필수 입력란을 할당합니다.
    # Construct and save floodlight activity.
    floodlight_activity = {
        'countingMethod': 'STANDARD_COUNTING',
        'expectedUrl': 'http://www.google.com',
        'floodlightActivityGroupId': activity_group_id,
        'floodlightTagType': 'GLOBAL_SITE_TAG',
        'name': 'Test Floodlight Activity'
    }
    
  4. floodlightActivities.insert()를 호출하여 새 활동을 저장합니다. 그러면 새 활동의 ID가 반환됩니다.
    request = service.floodlightActivities().insert(
        profileId=profile_id, body=floodlight_activity)
    
  5. 새 활동의 floodlightActivityIdfloodlightActivities.generatetag()를 호출하여 태그를 생성합니다. 광고주 웹사이트의 웹마스터에게 태그를 전송합니다.
    # Construct the request.
    request = service.floodlightActivities().generatetag(
        profileId=profile_id, floodlightActivityId=activity_id)
    
    # Execute request and print response.
    response = request.execute()
    

Ruby

  1. 새 플러드라이트 활동 그룹을 만들고 name, type, floodlightConfigurationId 값을 전달합니다.
    # Create a new floodlight activity group resource to insert.
    activity_group =
      DfareportingUtils::API_NAMESPACE::FloodlightActivityGroup.new(
        floodlight_configuration_id: floodlight_config_id,
        name:
          format('Example Floodlight Activity Group #%s', SecureRandom.hex(3)),
        type: 'COUNTER'
      )
    
  2. floodlightActivityGroups.insert()를 호출하여 플러드라이트 활동 그룹을 저장합니다. 그러면 새 그룹의 ID가 반환됩니다.
    # Insert the floodlight activity group.
    result = service.insert_floodlight_activity_group(profile_id, activity_group)
    
  3. 새 플러드라이트 활동을 만들고 방금 만든 플러드라이트 활동 그룹의 ID 및 기타 모든 필수 입력란을 할당합니다.
    # Create a new floodlight activity resource to insert.
    activity = DfareportingUtils::API_NAMESPACE::FloodlightActivity.new(
      counting_method: 'STANDARD_COUNTING',
      expected_url: 'http://www.google.com',
      floodlight_activity_group_id: activity_group_id,
      floodlight_tag_type: 'GLOBAL_SITE_TAG',
      name: format('Example Floodlight Activity #%s', SecureRandom.hex(3))
    )
    
  4. floodlightActivities.insert()를 호출하여 새 활동을 저장합니다. 그러면 새 활동의 ID가 반환됩니다.
    # Insert the floodlight activity.
    result = service.insert_floodlight_activity(profile_id, activity)
    
  5. 새 활동의 floodlightActivityIdfloodlightActivities.generatetag()를 호출하여 태그를 생성합니다. 광고주 웹사이트의 웹마스터에게 태그를 전송합니다.
    # Construct the request.
    result = service.generatetag_floodlight_activity(profile_id,
      floodlight_activity_id: activity_id)
    

게재위치 태그 생성

마지막 단계는 광고를 표시하기 위해 게시자에게 보낼 HTML 태그를 생성하는 것입니다. API를 통해 태그를 생성하려면 placements.generatetags()에 요청을 실행하여 placementIdstagFormats 집합을 지정합니다.

C#

// Generate the placement activity tags.
PlacementsResource.GeneratetagsRequest request =
    service.Placements.Generatetags(profileId);
request.CampaignId = campaignId;
request.TagFormats =
    PlacementsResource.GeneratetagsRequest.TagFormatsEnum.PLACEMENTTAGIFRAMEJAVASCRIPT;
request.PlacementIds = placementId.ToString();

PlacementsGenerateTagsResponse response = request.Execute();

Java

// Generate the placement activity tags.
Generatetags request = reporting.placements().generatetags(profileId);
request.setCampaignId(campaignId);
request.setTagFormats(tagFormats);
request.setPlacementIds(ImmutableList.of(placementId));

PlacementsGenerateTagsResponse response = request.execute();

2,399필리핀

$placementTags = $this->service->placements->generatetags(
    $values['user_profile_id'],
    ['campaignId' => $values['campaign_id'],
     'placementIds' => [$values['placement_id']],
     'tagFormats' => ['PLACEMENT_TAG_STANDARD',
                      'PLACEMENT_TAG_IFRAME_JAVASCRIPT',
                      'PLACEMENT_TAG_INTERNAL_REDIRECT']
    ]
);

Python

# Construct the request.
request = service.placements().generatetags(
    profileId=profile_id, campaignId=campaign_id,
    placementIds=[placement_id])

# Execute request and print response.
response = request.execute()

Ruby

# Construct the request.
result = service.generate_placement_tags(profile_id,
  campaign_id: campaign_id,
  placement_ids: [placement_id])