Customizing Text Ads

Customizing standard and expanded text ads can be done through ad customizers, countdowns, and IF functions. Ad customizers offer greater flexibility than using ad parameters.

An ad customizer is a feed-based solution for injecting dynamic information into your ads. You can set up a feed with targeting options for specific campaigns, ad groups, and/or keywords, and then create ads that reference the information in the feed, so the values in the feed are shown at serve time.

You can put strings, prices, numbers, and even a countdown to a specific date or time in your ad.

Ad customizers

A common use case for ad customizers is promoting a sale price on an item during a specific date range. To do this, you set up a feed with a string attribute for the item name, another string attribute for the price, and a date attribute for the date your sale ends, then populate a feed item accordingly.

When setting up your ad, you reference the feed item, its name attribute, and its sale price attribute: AdWords automatically populates the ad with the name and price from the feed item.

To use the feed item's end date, you include the date attribute in a function that tells AdWords to display a countdown to the end date in your ad. When creating the ad, reference the feed item and its name, sale price, and end date attributes: AdWords automatically populates the ad with the name, price, and end date from the feed item.

When you have your next sale, you can re-use the ad by updating your feed item's price and end date values, instead of creating a new ad each time.

The following sections describe all phases of this use case, including how to:

  • Set up the feed and its attributes
  • Create feed items with the values you want to appear in your ads
  • Target feed items to a specific campaign, ad group or keyword
  • Use the feed in an ad
  • Add a countdown
  • Add an IF function

Set up the feed

The first step is to create a feed with all of the attributes you'll need to customize your ad.

The feed below has three attributes; two of type STRING and one of type DATE_TIME:

Java

AdCustomizerFeed customizerFeed = new AdCustomizerFeed();
customizerFeed.setFeedName(feedName);

AdCustomizerFeedAttribute nameAttribute = new AdCustomizerFeedAttribute();
nameAttribute.setName("Name");
nameAttribute.setType(AdCustomizerFeedAttributeType.STRING);

AdCustomizerFeedAttribute priceAttribute = new AdCustomizerFeedAttribute();
priceAttribute.setName("Price");
priceAttribute.setType(AdCustomizerFeedAttributeType.STRING);

AdCustomizerFeedAttribute dateAttribute = new AdCustomizerFeedAttribute();
dateAttribute.setName("Date");
dateAttribute.setType(AdCustomizerFeedAttributeType.DATE_TIME);

customizerFeed.setFeedAttributes(
    new AdCustomizerFeedAttribute[] {nameAttribute, priceAttribute, dateAttribute});

Take note of the IDs for the feed itself and for its attributes, as you'll need them when setting up the feed item. You can fetch these attributes directly from the result of the mutate call.

Java

AdCustomizerFeedOperation feedOperation = new AdCustomizerFeedOperation();
feedOperation.setOperand(customizerFeed);
feedOperation.setOperator(Operator.ADD);

AdCustomizerFeed addedFeed = adCustomizerFeedService.mutate(
    new AdCustomizerFeedOperation[] {feedOperation}).getValue()[0];

System.out.printf(
    "Created ad customizer feed with ID %d, name '%s' and attributes:%n",
    addedFeed.getFeedId(), addedFeed.getFeedName());
for (AdCustomizerFeedAttribute feedAttribute : addedFeed.getFeedAttributes()) {
  System.out.printf(
      "  ID: %d, name: '%s', type: %s%n",
      feedAttribute.getId(), feedAttribute.getName(), feedAttribute.getType());
}

The returned attributes appear in the same order you specified when creating the feed.

Create targeted FeedItems

Create a FeedItem to restrict the feed to only a specific campaign, ad group, keyword, or location, using the campaignTargeting, adGroupTargeting, keywordTargeting, or geoTargeting attributes of the FeedItem.

Using the IDs retrieved when creating the feed in the step above, you can add feed items. The code sample below passes each feed item's values to a helper function.

Java

DateTime now = new DateTime();

DateTime marsDate = new DateTime(now.getYear(), now.getMonthOfYear(), 1, 0, 0);
feedItemOperations.add(createFeedItemAddOperation("Mars", "$1234.56",
    marsDate.toString("yyyyMMdd HHmmss"), adGroupIds.get(0), adCustomizerFeed));

DateTime venusDate = new DateTime(now.getYear(), now.getMonthOfYear(), 15, 0, 0);
feedItemOperations.add(createFeedItemAddOperation("Venus", "$1450.00",
    venusDate.toString("yyyyMMdd HHmmss"), adGroupIds.get(1), adCustomizerFeed));

The helper function sets up the feed item with the values provided:

Java

FeedItem feedItem = new FeedItem();
feedItem.setFeedId(adCustomizerFeed.getFeedId());

List<FeedItemAttributeValue> attributeValues = new ArrayList<>();

// FeedAttributes appear in the same order as they were created - Name, Price, Date.
// See the createCustomizerFeed method for details.
FeedItemAttributeValue nameAttributeValue = new FeedItemAttributeValue();
nameAttributeValue.setFeedAttributeId(adCustomizerFeed.getFeedAttributes(0).getId());
nameAttributeValue.setStringValue(name);
attributeValues.add(nameAttributeValue);

FeedItemAttributeValue priceAttributeValue = new FeedItemAttributeValue();
priceAttributeValue.setFeedAttributeId(adCustomizerFeed.getFeedAttributes(1).getId());
priceAttributeValue.setStringValue(price);
attributeValues.add(priceAttributeValue);

FeedItemAttributeValue dateAttributeValue = new FeedItemAttributeValue();
dateAttributeValue.setFeedAttributeId(adCustomizerFeed.getFeedAttributes(2).getId());
dateAttributeValue.setStringValue(date);
attributeValues.add(dateAttributeValue);

feedItem.setAttributeValues(
    attributeValues.toArray(new FeedItemAttributeValue[attributeValues.size()]));

feedItem.setAdGroupTargeting(new FeedItemAdGroupTargeting(adGroupId));

The items will be fetched only for the ad group specified for the targeting_ad_group_id. Any ad in that ad group will use these feed items for the dynamic replacements.

If multiple feed items match in a given context, the system uses an algorithm to pick one automatically. This algorithm may vary over time. If you want greater control over which feed items are used for which contexts, make sure to use specific targeting within the feed items.

Use the feed in an ad

Once the feed is set up, you can reference it from any ad in the system.

When setting up an ad, you reference a feed and its attributes by name, not by ID. This is different from the other steps, where you use the system-generated IDs.

The syntax for inserting a custom value from a feed is {=FeedName.AttributeName}. If you want to specify a default value, the syntax would be {=FeedName.AttributeName:default value}. For example, using our feed above, if you want to insert the price of an object in the string with a default of $10, use {=AdCustomizerFeed.Price:$10}:

Java

ExpandedTextAd textAd = new ExpandedTextAd();
textAd.setHeadlinePart1(String.format("Luxury Cruise to {=%s.Name}", feedName));
textAd.setHeadlinePart2(String.format("Only {=%s.Price}", feedName));
textAd.setDescription(String.format("Offer ends in {=countdown(%s.Date)}!", feedName));
textAd.setFinalUrls(new String[] {"http://www.example.com"});

If this ad is added via the AdGroupAdService, the references to AdCustomizerFeed are populated at serving time with matching data from a feed item within that feed that matches the current ad group. The ad won't serve if no match is found.

The API validates ads that include references to ad customizers: If no feed with the specified name is mapped to the ad placeholder type, or no attribute with a specified name exists in the feed, the ad is rejected.

If you change the name of a feed when ads are referencing it, the ads are automatically updated to reference the new feed name. If you delete a feed when ads are referencing it, those ads will no longer serve.

Ads using customizers are subject to approvals just like any other ads. Feed items and ads can both be disapproved separately, though disapproval of either will prevent the ad from serving. In rare cases where each is individually fine, but the combination of the two is a violation, the ad will be disapproved to prevent serving.

Add a countdown

The COUNTDOWN function allows you to dynamically change the way you display a date field so it shows how much time (days, hours) is left.

For example, the description of the ad example above is set to 'Offer ends in {=COUNTDOWN(AdCustomizerFeed.Date)}!' At serve time, the ad will show "Offer ends in 5 days!" or "Offer ends in 4 hours!" based on the time left.

Once the date specified in the countdown is past, the ad will no longer serve until the date is updated again.

The countdown function takes three arguments, but only the first is required:

  • timestamp: The date to which you are counting down. This value can be a reference to a feed attribute or a specific date literal.
  • language: The localization in which the countdown should be displayed. If unspecified, this defaults to en-US.
  • days_before: The number of days before the timestamp that this ad can start serving. For example, if it's 6 days before the specified time, but this field is set to 5, the ad won't serve. If unspecified, no restrictions are added.

For example, you could use {=COUNTDOWN(AdCustomizerFeed.Date, 'es', 3)} to change the language to Spanish, and restrict the ad so it doesn't appear in search results until 3 days before the date specified.

The COUNTDOWN function counts down to an event in the timezone of the user making the query. A variant of COUNTDOWN, called GLOBAL_COUNTDOWN, counts down to a specific time in your account's time zone. GLOBAL_COUNTDOWN takes all the same parameters as COUNTDOWN.

Add an IF function

IF functions let you insert a customized message in your ad based on who is searching and what device they're searching on, all without using a feed. The default text is optional.

Dimension Criteria Syntax Example
device mobile {=IF(device=mobile,text to insert):optional default text} {=IF(device=mobile,"Quick, Easy, Mobile Booking"):"Best price guarantee"}
audience Any valid user list name in your account (if list name matches multiple lists in advertiser account, we will randomly pick any) {=IF(audience IN (userlist1,userlist2),text to insert):optional default text} {=IF(audience IN (returning visitors,cart abandoners),30%):25%}

Code examples

Code examples in each of the supported languages can help you get started with adding an ad customizer:

Ad parameters

Ad params allow for dynamically updating numerical information in an ad without having to resubmit the ad for review and approval. It's similar to keyword insertion where markups within the ad are updated when displayed. Ad params are managed via the API through AdParamService.

An ad parameter is represented by an AdParam object. For an AdParam to work properly, it must:

  • Be specified for the Keyword, AdGroup, and paramIndex of that impression.
  • Not cause any text field of the ad to exceed the line length limit after all ad parameters have been applied.
  • Be part of an ad being shown on the Google Search Network.

Default values are shown for the ad parameter if there is a problem during its insertion.

Code examples

Code examples in each of the supported languages can help you get started with managing ad params:

Enviar comentarios sobre…

¿Necesitas ayuda? Visita nuestra página de asistencia.