Tag functions empower you to manipulate data within your tags, bringing efficiency and accuracy to your advertising efforts. These automations save time and enhance precision by allowing you to remove unwanted words, perform basic math functions, change data formats, and more.
In This Article:
To apply a function to a tag, use >> within the tag.
Example:
[inventory.make>>SORT]
Tag output: [Corolla, Accord, F-150, Altima]
Output with function: [Accord, Altima, Corolla, F-150] The tag output has been sorted alphabetically.
Sometimes, a function requires more specific parameters, usually indicated within parentheses after the function.
Example:
[inventory.condition>>REMOVE(New)]
Tag output: [New, Used, Certified, Pre-Owned, Used, New]
Output with function: [Used, Certified, Pre-Owned, Used] All instances of "New" have been removed from the tag output.
You can also apply multiple functions in a single tag. The functions will resolve from left to right in order of operation.
Example:
[inventory.year>>MAX>>MINUS(1)]
Output: [2015, 2017, 2019, 2022]
Tag output with function: [2021] The function first selects the maximum value (2022) and then subtracts 1.
To apply functions to multiple tags, place | at the end of a group of tags.
Example:
[YEAR] [MAKE] [MODEL] [TRIM]|>>REPLACE( ,Car)
This will replace any space in the above string of tags with the word Car.
Expand the rows below for a comprehensive list of tag functions available in Backpack:
Currency
($) - No cents
($.) - With cents
[inventory.price>>FORMAT($)]
Tag output: [8000]
Output with function: [$8,000]
Percentage
(%) - No decimal
(%.) - 1 decimal
[inventory.price>>FORMAT(%.)]
Tag output: [5.15]
Output with function: [5.2%]
(#) - Numerical format, 1 decimal
(,) - General # with comma
(.) - General #, no comma, 2 decimals
(,.) - General # with comma, 2 decimals
Casing
Note: We'll use the tag and output below for the function examples that follow.
[fluency.founders]
Output: [ERIC, Brian, mike, scott]
LOWER - All lowercase
UPPER - All uppercase
[fluency.founders>>UPPER]
Output: [ERIC, BRIAN, MIKE, SCOTT]
TITLE+ - Uppercase first letter
[fluency.founders>>TITLE+]
Output: [ERIC, Brian, Mike, Scott]
TITLE - Uppercase first letter with exception
[fluency.founders>>TITLE(Mike)]
Output: [ERIC, Brian, mike, Scott]
Plural and Possessive
Note: We'll use the tag and output below for the function examples that follow.
[fluency.founders]
Output: [Eric, Brian, Mike, Scott]
PLURAL - Changes to plural form
[fluency.founders>>PLURAL]
Output: [Erics, Brians, Mikes, Scotts]
POSSESSIVE - Changes to possessive form
[fluency.founders>>POSSESSIVE]
Output: [Eric’s, Brian’s, Mike’s, Scott’s]
Removing Empty Spaces
TRIM - Removes empty spaces before and/or after text
[fluency.founders>>TRIM]
Tag output: [Eric , Brian , Mike, Scott]
Output with function: [Eric, Brian, Mike, Scott]
PLUS
MINUS
MULTIPLY
DIVIDE
[inventory.year>>PLUS(2)]
Tag output: [2023]
Output with function: [2025]
SUM - Sum of all the values
[inventory.price>>SUM]
Tag output: [1000, 1200, 1500, 2000]
Output with function: [5700]
AVG - Average of the values
[inventory.price>>AVG]
Tag output: [1000, 1200, 1500, 2000]
Output with function: [1425]
MAX - Selects the highest number value
MIN - Selects the lowest number value, including zero
MINNONZERO - Selects the lowest number value, excluding zero
[inventory.price>>MAX]
Tag output: [0, 50, 1000, 1200]
Output with function: [1200]
[inventory.price>>MINNONZERO]
Tag output: [0, 50, 1000, 1200]
Output with function: [50]
COUNT - Counts the number of values
[inventory.price>>COUNT]
Tag output: [0, 50, 1000, 1200]
Output with function: [4]
COUNTIFOVER/COUNTIFUNDER - Counts the number of values over/under a specified condition.
[inventory.price>>COUNTIFUNDER(5)]
Tag output: [0, 50, 1000, 1200]
Output with function: [4]
DAYSAGO - Counts the number of days between the present day and the tag dates
[Listings.closeDate>>DAYSAGO]
Tag output: [2023-10-10, 2023-10-11]
Output with function: [60, 59]
Manipulation functions are more complex functions that allow you to change and arrange tag values.
REMOVE(Remove) - Remove all instances of one data value
[inventory.condition>>REMOVE(New)]
Tag output: [New, Used, Certified]
Output with function: [Used, Certified]
REMOVEALL(Remove1, Remove 2) - Removes all instances of specified data values
[inventory.condition>>REMOVEALL(New,Used)]
Tag output: [New, Used, Certified]
Output with function: [Certified]
REPLACE(Old Output, New Output) - Replaces all instances of one value with another
[inventory.condition>>REPLACE(Used, PreOwned)]
Tag output: [New, Used, Certified]
Output with function: [New, PreOwned, Certified]
REPLACE_IF_OVER(#, Output) - Replaces content that's over a defined character count (e.g., REPLACE_IF_OVER(30,[new headline]))
[inventory.condition>>REPLACE_IF_OVER(10, Philly)]
Tag output: [Pittsburg, Philadelphia]
Output with function: [Pittsburg, Philly]
IF(Condition, then New Output) - Replaces data value based on conditions
IFEXISTS(Condition, then New Output) - Tests the field, returns output based on existence of specified condition
[inventory.condition>>IF(Used,PreOwned)]
Tag output: [New, Certified, Used)]
Output with function: [New, Certified, PreOwned]
DISTINCT - Returns list of unique values, removes duplicates
[inventory.condition>>DISTINCT]
Tag output: [New, New, Used, Certified, New]
Output with function: [New, Used, Certified]
NONNULL - Returns list of non-empty values
[inventory.condition>>NONNULL]
Tag output: [New, , Used, Certified, , New]
Output with function: [New, Used, Certified, Used]
SORT - Sorts alphabetically
SORT DESC - Sorts reverse alphabetically
LIMIT(#) - Returns the first instances of the number of data values specified
SHUFFLE - Randomly sorts all values
[inventory.condition>>SORT]
Tag output: [New, Used, Certified]
Output with function: [Certified, New, Used]
[inventory.condition>>LIMIT(2)]
Tag output: [New, Used, Certified, PreOwned]
Output with function: [New, Used]
CONCAT - Merges separate values into a single value
CONCAT_TO(#) - Limits list length
[inventory.condition>>CONCAT]
Tag output: [New, Used, Certified]
Output with function: [New Used Certified]
SPLIT() - Separates a single value toto separate values, defines what the desired split should occur on (e.g., spaces, commas, periods, etc.)
[inventory.condition>>SPLIT( )]
Tag output: [New Used Certified]
Output with function: [New, Used, Certified]
END_AT(First Instance) - Removes the first instance of the text and everything that follows
[headline>>END_AT(Special)]
Tag output: [Your Favorite Special]
Output with function: [Your Favorite]
END_AT_LAST(Last Instance) - Looks for the last instance of an entered value and ends the list before the entered value
[headline>>END_AT_LAST(Special)]
Tag output: [Your Favorite Special Special Special]
Output with function: [Your Favorite Special Special]
FIELD - Returns the element's name, not the tag's value (JSON compatibility)
Force Pinning
When a tag might return an invalid value, use force pinning to establish a default value. This is useful for handling invalid URLs in Preferred Paths and assigning tags to specific fields in creatives.
Example: -> [preferred path tag]
Fall throughs enable you to specify an output if an initial tag fails to resolve. Add a double colon (::) at the end of a tag, followed by your desired outputs.
Example: [new-inventory.price::Call For Price]
Nested tags are "tags within tags," providing a way to incorporate additional variations within the same tag.
Example: [[inventory.make] Tagline]
Functions can leverage JavaScript for more advanced outputs.
FUNC(VALUE)
[make>>FUNC(VALUE.toLowerCase().trim())]
Example: Let's say you do not want to advertise any car models in your Facebook AIA ads that have a stock image.
Identify 3 signifiers that appear in the image url from your inventory feed: 'stock' 'images.site.com,' vehiclephotos.site.com'
Go to Settings & Tools > Catalogs.
Scroll down to Images and select + Add Images.
Use Javascript tag functions in the Url field under Edit Inventory Images Mappings.[inventory.image0_url>>FUNC(VALUE.includes('vehiclephotos.site.com') || VALUE.includes ('stock) || VALUE.includes ('images.site.com'))]>>IF(true,,[inventory.image0_url])
Note: Separate each signifier with || (include a space on both ends of the pipes).
We understand this is a lot of info. Don't worry; we won't quiz you. Grab a tag functions cheat sheet for your desk by clicking below.