Add and manage inventory rules in a manual campaign

Inventory attributes and template functions

Use inventory attributes and template functions:

For example, you can create an ad template that generates "Free shipping" for products that cost more than $25.

Inventory attributes pass data from your inventory account to your templates and inventory rules. Template functions add logic, such as if/then, to your templates.

Inventory attributes

You can insert data from any product attribute defined in your inventory feed. The syntax is [ATTRIBUTE_NAME]. Specify standard product attributes in all upper case (for example, [SIZE]).

If you use an inventory attribute in a template function, don't surround the attribute name with brackets (the function already specifies the brackets). For example:
[IF(custom_attribute_0="test", "Sale on " CATEGORY_LEVEL_1, "Sale on " CATEGORY_LEVEL_2)]

In this case, the entire function is wrapped in brackets, so you shouldn't wrap the nested attribute names (custom_attribute_0, CATEGORY_LEVEL_1 and CATEGORY_LEVEL_2) in additional brackets.

Note that in a function, static text needs to be wrapped in quotation marks, while attribute names need to be outside of the quotation marks. For example:
"Sale on " CATEGORY_LEVEL_1

Custom attributes

In addition to the standard product attributes that you can include in your feed, you can also include custom attributes that are unique to your business needs. These custom attributes appear alongside the standard attributes in the Add attribute or funcion list within the DS UI.
Custom attributes appear in the DS UI alongside standard attributes.

Depending on how you define the custom attributes in your XML or tab-delimited data feed, DS may display custom attribute names prefixed with "c:", such as c:battery_life:decimal.

To use a custom attribute in a DS template, specify the name that appears in the Add attribute or function list. For example, if you see battery_life in the Add attribute or function list, specify [battery_life] in a keyword or ad template. If you see c:battery_life, specify [c:battery_life] in a keyword or ad template.

Template functions

You can create conditional or relational functions in your templates, leveraging fields available in your Google Merchant Center feed. Mix and match Merchant Center fields and functions to create and automate timely and specific ad copy and keywords. Remember to surround each function with [], as shown in this example.

List of functions

See the list and description of template functions and operators.

Special characters in template functions

When using a template function for ads or keywords in inventory campaigns, you can include the following special characters in your static text, as long as you escape them:

  • [
  • ]
  • \

This allows you to perform actions on these special characters, while the system can still use them with their original meaning as the start and end of a literal string or template function. Special characters make it easier for you to clean up data from the Merchant Center feed to prepare it for inventory-aware campaigns. You can convert a Merchant Center field into a keyword template, while easily stripping invalid characters from the keyword text.

To use these characters in a text string, they must be preceded by a backslash:

  • \”
  • \[
  • \]
  • \\

After you save the inventory template, the preceding backslash will disappear in the DoubleClick Search (DS) UI.

Default values

You can specify default values for inventory attributes or functions. Here's the syntax:
[ATTRIBUTE:"default value"]
[FUNCTION():"default value"]

DS uses the defaults as follows:

  • Default values for inventory attributes - If inventory items have different values for a specific attribute, DS uses the default value.
  • Default values for functions - If the result of a function causes a line in the ad copy to exceed the maximum length, DS will recalculate the text using the function's default value. If the text is still too long after using the default value, DS reports an error.

    For nested functions, DS uses the default value on the top level; if that value is not applicable, DS uses the default value in the lower level.

Examples: [PRICE:20] - DS uses 20 if items in the feed have different prices.
[BRAND:”Adidas”] - DS uses "Adidas" if items in the feed have different brand names.
[if(max(PRICE) > 0, “very fast”, “very cheap”):”free”] - If the maximum price is greater than 0, then the function returns "very fast". If the resulting string is too long, the function returns "free".

Examples

Example 1
  1. In your inventory system, the DESCRIPTION attribute of an item contains the quote (“) character:
    "Size is 12"x12"x3/8"

  2. You don’t want the character to display in your ad text, so you use the substitute function to replace the quote with an empty character:
    [substitute(DESCRIPTION, "\"", "")]

  3. After you save the template, DS displays the following template text in the UI:
    [substitute(DESCRIPTION, """, "")]

  4. Based on the template text, the generated text will be:
    Size is 12x12x3/8

Example 2
  1. Enter the following in your ad template:
    [substitute(DESCRIPTION, “\"fast\"”, if(PRICE>0, “\"free\"”, “\"cheap\"”))] shipping

  2. After you save the template, DS displays the following template text in the UI:
    [substitute(DESCRIPTION, “"fast"”, if(PRICE>0, “"free"”, “"cheap"”))] shipping

  3. If the price is greater than 0, the generated ad text would be:
    “free” shipping

Was this article helpful?
How can we improve it?