SetFinalUrlSuffix Campaign Types Support

76 views
Skip to first unread message

Markus

unread,
Dec 2, 2024, 11:12:32 AM12/2/24
to Google Ads API and AdWords API Forum
Hey, 

Which campaign Types does setFinalUrlSuffix support?

Google Ads API Forum Advisor

unread,
Dec 2, 2024, 2:50:50 PM12/2/24
to berka...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

I would like to inform you that the finalUrlSuffix in Google Ads can be applied to all campaign types.

Hope this helps. If you have any more queries, please feel free to get back to us.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vGmzJ:ref" (ADR-00277410)

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5


 


Markus

unread,
Dec 3, 2024, 4:12:05 AM12/3/24
to Google Ads API and AdWords API Forum
Hi, 

Thanks for your Response. 
I successfully implemented URL suffixes for Search and Display campaigns, but for some reason I'm encountering an issue when trying to apply them to Video campaigns.

Error:   
TypeError: videoAd.urls(...).setFinalUrlSuffix is not a function



function main() {
  var customerIds = ["..."];

  for (var i = 0; i < customerIds.length; i++) {
    var account = AdsManagerApp.accounts().withIds([customerIds[i]]).get().next();
    AdsManagerApp.select(account);
    Logger.log("Processing account: " + account.getCustomerId());

    var query = `
      SELECT
        campaign.id,
        campaign.name,
        campaign.status,
        campaign.advertising_channel_type
      FROM
        campaign
    `;
    var campaignIterator = AdsApp.report(query).rows();

    processCampaigns(campaignIterator);
  }
}

function processCampaigns(campaignIterator) {
  var source = "google";

  while (campaignIterator.hasNext()) {
    var row = campaignIterator.next();
    var campaignId = row["campaign.id"];
    var campaignName = row["campaign.name"];
    var channelType = row["campaign.advertising_channel_type"];

      if (channelType === "VIDEO") {
        var videoAdIterator = AdsApp.videoAds()
          .withCondition("CampaignId = " + campaignId)
          .get();
        while (videoAdIterator.hasNext()) {
          var videoAd = videoAdIterator.next();
          var videoName = videoAd.getName();

          var finalSuffix = encodeURI(
            "utm_source=" +
              source +
              "&utm_medium=video" +
              "&utm_campaign=" +
              encodeURIComponent(campaignName) +
              "&utm_content=" +
              encodeURIComponent(videoName) +
              "&utm_term={keyword}"
          );

          Logger.log("Final URL Suffix: " + finalSuffix);

          // Set the final URL suffix for the video ad
          videoAd.urls().setFinalUrlSuffix(finalSuffix);
        }
    }
  }

}




Google Ads API Forum Advisor

unread,
Dec 3, 2024, 9:06:02 AM12/3/24
to berka...@gmail.com, adwor...@googlegroups.com

Hi,

If you are using a Google Ads API client library to set the final URL suffix for a video campaign, please note that video campaigns cannot be mutated at all from the API, including simple operations such as pausing or enabling as well as complex operations like organizing, changing criteria, or adding ad groups. You may refer to the Campaigns document for more information.

Markus

unread,
Dec 5, 2024, 10:20:41 AM12/5/24
to Google Ads API and AdWords API Forum
Hi, 

Oh okey. What about Demand_Gen Campaigns? Does it work with this type?

Google Ads API Forum Advisor

unread,
Dec 5, 2024, 3:31:43 PM12/5/24
to berka...@gmail.com, adwor...@googlegroups.com
Hi,

Yes, Demand_Gen campaigns support final_url_suffix.


Hope this helps. If you have any more queries, please feel free to get back to us.
 

Markus

unread,
Dec 6, 2024, 4:07:19 AM12/6/24
to Google Ads API and AdWords API Forum
Hi, 

  Could you please clarify how I can properly modify Demand Gen Final URL Suffix. 
  As far as I know, there isn’t a specific selector for Demand Gen campaigns to access the campaign or its ads directly.  

  Here’s an example of how I would like to handle this, but this not works:
if (channelType === "DEMAND_GEN") {  
    var adIterator = AdsApp.ads()  

        .withCondition("CampaignId = " + campaignId)  
        .get();  

    while (adIterator.hasNext()) {  
        var ad = adIterator.next();  
        var creativeName = ad.getHeadline();  


        var finalSuffix = encodeURI(  
            "utm_source=" +  
            source +  
            "&utm_medium=" +  
            medium +  

            "&utm_campaign=" +  
            encodeURIComponent(campaignName) +  
            "&utm_content=" +  
            encodeURIComponent(creativeName) +  
            "&utm_term={keyword}"  
        );  

        ad.urls().setFinalUrlSuffix(finalSuffix);  

Google Ads API Forum Advisor

unread,
Dec 6, 2024, 9:49:45 AM12/6/24
to berka...@gmail.com, adwor...@googlegroups.com
Hi,

You can set the final url suffix while creating the campaign using the Google Ads API. To do this, you can use the final_url_suffix field. Also, you can use update operation to modify the final url suffix, if you encounter any issues while implementing, kindly provide us with the complete API logs (request and response with request-id and request header) generated at your end to better assist you.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag. 

You can send the details via Reply privately to the author option, or direct private reply to this email.
Reply all
Reply to author
Forward
0 new messages