To generate unique ad copy, keywords, campaign and ad group settings, and so on, add Search Ads 360 functions, inventory attributes, or formula columns to your inventory templates. When you want to use the same value for all ads, keywords, or other items, enter static text or numbers depending on the setting's data type.
For example, in the ad template below:
- Headline 1 outputs static text: "Sale on outdoor shoes".
- Headline 2, contains the following formula to generate "Free shipping" for products that cost more than $25:
[if(max(Item_price) < 25, "Fast", "Free")] shipping.
To generate the output, Headline 2 combines two functions (if
andmax
), static numbers and text, and the Item_price inventory attribute.
Syntax for inventory templates
The syntax for entering campaign, ad group, ad, keyword and other settings in an inventory template is as follows:
- Static text and numbers can be entered directly into a template.
- Dates always need to be entered in a function, such as the date function.
- All functions, inventory attributes, and formula columns need to be surrounded by
[ ]
(square brackets)
To include the [ ] characters in your ad copy, escape them as follows:
\[ \]
Example: \[*EngineAccountType*\])
- Escapes a macro.
Availability of functions depends on context
Search Ads 360 provides an extensive collection of functions, but some functions can only be used in formulas or formula columns that contain inventory data. For example, max(ATTRIBUTE)
calculates the maximum value of an inventory attribute among all items in an ad group. So it's only applicable to inventory data.
Other functions can only be used in formula columns that contain engine or conversion metrics. For example, for_date_range(date)
can only be used with metrics: Clicks.for_date_range(last_7_days())
When you're creating inventory templates, Search Ads 360 shows only the functions that are valid for the current context.
Handling invalid values
Since it isn't possible to anticipate every possible variation in data, make sure your functions handle potential errors gracefully. Search Ads 360 doesn't generate campaigns, ads, and other items if a function returns an empty or invalid value. You can use any or all of the following approaches for error handling:
- Wrap functions in
if_error(function, alternate)
orif(is_error(function), alternate1, alternate2)
. If function returns an error or is empty, alternate is returned instead. - Use the
if(condition, true, else)
function to filter or change undesirable results. - Wrap inventory attributes in
min(ATTRIBUTE)
,max(ATTRIBUTE)
, or any(ATTRIBUTE) unless you're sure each ad group will contain only one value for the attribute.
For example, specifymax(Item_price)
if an ad group could contain products with different prices. - In ad templates, create alternates for each field in case the output of your template is too long.
Create formula columns to use in inventory templates
If you frequently use the same functions, inventory attributes, and static text in your templates, you can define the logic in a formula column and use the formula column in your templates instead of repeating the logic in each template.
For example if you frequently prefix a product's price with the $ character and output the price with two decimal places, you could do the following:
- Create a formula column that contains this formula:
"$" & to_string(Item_price, 2)
- Name the column something descriptive, such as price_with_currency.
- Include the column when needed in a template. For example, include this line in an ad template's Description:
Prices start at [c:"price_with_currency"
]
To create formula columns that can be used in inventory templates:
-
In the left navigation panel, click Templates.
-
Click the Inventory items tab.
-
Click the Columns button in the toolbar above the performance summary graph.
The column selection tool appears. -
Click Formula columns under the Available columns header.
A list of formula columns that have already been created in the advertiser appears. -
Click Create a new column.
The pop-up with the settings for your new column appears. -
Name your column.
This is the name that you'll see when creating inventory templates, so make sure it’s meaningful to all users who will see it. -
In the Enter equation box, create a new formula.
Use the search field to find the names of inventory attributes or functions you can use. Be sure to use the syntax for formula columns, which is different from the syntax for inventory templates. - Click Save.
- If an error occurs, click Select error to highlight the specific error, attempt to fix it, and click Save again.
- Once you have resolved all errors, the column will automatically appear in the list of selected columns.