Notification

Please be advised that the Customer Support team does not provide troubleshooting services in your current display language. To contact Support team staff, please first switch to English or other supported languages (Spanish, Portuguese or Japanese). 

contains

Returns True when haystack text string contains needle

Syntax

contains(needle, haystack)

Parameters

haystack and needle can be any of the following:

  • Static text, such as 'GDN'.
  • A Search Ads 360 variable that is a string, such as a Keyword, Campaign and so on.
  • An expression or formula column that returns a string.

Case insensitive

Text comparisons are case insensitive. That is, contains("gdn", "GDN") evaluates to true.

Empty character

If you include an expression or formula column in this function, the expression or formula column could evaluate to an empty text string.

Make sure that you're aware that all strings end with an empty (zero-length) string. For example, ends_with("GDN", "") will evaluate to true.

On the other hand, ends_with("", "GDN") evaluates to false. An empty text string does not end with non-empty text strings.

Examples

  • [contains("hook", "fishhook")]
    evaluates to true
  • If a keyword contains 'hoopers', display 'brand'. For other keywords, display 'non-brand':
    [if(contains("hoopers", keyword), "brand", "non-brand")]
  • If a keyword contains 'hoopers' and is contained in a campaign that starts with 'US', display 'US brand':
    [if(and(contains("hoopers", keyword), starts_with(campaign, "US")), "US brand", "non-brand")]
  • If campaign contains 'Shopping' or 'GDN' or 'RLSA', display 'budget 1', for others display 'budget 2':
    [if(or(contains("Shopping", campaign), contains("GDN", campaign), contains("RLSA", campaign)), "budget 1", "budget 2")]

Related links

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

true
Search
Clear search
Close search
Main menu
6212313064201731921
true
Search Help Centre
true
true
true
true
true
5055977
false
false