Notification

Welcome to the help center for Search Ads 360, a platform for managing search marketing campaigns.  While the help center is available to the public, access to the Search Ads 360 product is available only to subscribing customers who are signed in. To subscribe or find out more, contact our sales team.

REDUCE_WORDS

Returns as many characters as possible, starting from the beginning of a string and counting up to a delimiter, while staying within max_length. If the string is already within max_length, the function returns string exactly as it was passed in.

Always counts in the natural direction of the advertiser’s locale. For example, if the advertiser’s language is English, this function counts from left to right.

Syntax

REDUCE_WORDS(string, max_length, delimiter, [delimiter], ...)
Specify the function name in upper case: REDUCE_WORDS

Parameters

  • string: An inventory string attribute such as DESCRIPTION, or a static string surrounded by quotes such as "My great shoe store".
    Specify standard inventory attributes in upper case; use the Search Ads 360 UI for guidance on specifying custom attributes.
  • max_length: the maximum number of characters in the output string. Can be any of the following:
    • 0 (zero).
    • A positive integer, such as 5.
    • An expression or inventory function that returns a positive number.
  • delimiter: A single character such as " ", a static string such as "store", or an inventory string attribute such as BRAND. If you specify more than one delimiter, the function uses the delimiter that yields the longest string fitting within max_length.

Examples

  • REDUCE_WORDS("My great shoe store", 10, " ") returns "My great". To calculate this string, the function follows these steps:

    1. Finds the last instance of the delimiter (which is the space between "shoe" and "store").

    2. Counts backwards 10 characters to see if it has reached the beginning of the string.

    3. In this example, the function doesn't reach the beginning, so it moves to the previous instance of the delimiter, the space between "great" and "shoe", and counts backwards 10 characters.

    4. The function reaches the beginning of the string before finishing the count, so it returns everything preceding the delimiter.

  • REDUCE_WORDS(DESCRIPTION, 15, " and"). If the inventory feed specifies "Low prices and wide selection" for the DESCRIPTION attribute, this function returns "Low prices". Note that the delimiter includes a space before "and". Without the space in the delimiter, the function would return "Low prices ".
  • REDUCE_WORDS(DESCRIPTION, 15, " "). If the inventory feed specifies "Low prices" for the DESCRIPTION attribution, the function returns "Low prices".

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

true
Search
Clear search
Close search
Main menu
11583624848523382382
true
Search Help Center
true
true
true
true
true
263
false
false