Skip to main content

Setting conditions for your advertising elements with valid when statements

Control campaign, ad group, and ad visibility based on conditions.

Valid when statements empower you to show the right ad elements at the right time. They can be used for campaigns, ad groups, and ads. They work like "if statements": If it's true, the content is enabled; if it's false, it stays disabled. If there's no statement, the campaign, ad group, or ad is automatically enabled. Valid when statements can be used in various ways, but most often with feature flags.


Creating valid when statements

Follow along with the video or use the instructions below.

For campaigns and ad groups

  1. Hover over Automate (rocket icon), and select Blueprint Editor.

  2. Choose a Blueprint, then a campaign or ad group.

  3. Click Valid When to expose the field.

For creatives

  1. Hover over Automate (rocket icon), and select Blueprint Editor.

  2. Choose a Blueprint, then a campaign and ad group.

  3. Select the Display dropdown near the top and toggle on Show Advanced Fields.

  4. Open the Creatives section—you may need to scroll to find it—and select an ad.

  5. In the creative, locate the Valid When field and add the valid when statement.


Writing valid when statements

Use the guidance below to create valid when statements for campaigns, ad groups, and creatives. When finished, be sure to save within the Blueprint.

Valid when statements are made up of elements (e.g., feature flags and tags) and functions that set conditions for enabling the campaign, ad group, or ad.

Feature flags

When using feature flags in valid when statements, the syntax is [Feature Flag Group Name.Flag Name].

Examples:

  • [Campaigns.Discovery Test]

  • [Campaigns.Display Test]

Valid when functions

Use functions in valid when statements to indicate how the platform should interpret the included tags and feature flags:

  • AND

  • OR

  • EQUALS or =

  • ENDS WITH

  • CONTAINS

  • CONTAINS_ANY

  • CONTAINS_ALL

  • DOES NOT CONTAIN

  • DOES NOT EQUAL or !=

  • GREATER THAN or >

  • LESS THAN or < (spaces on both sides required)

  • GREATER THAN OR EQUAL or >=

  • LESS THAN OR EQUAL or <=

Note: Spaces are required before and after certain signs: =, !=, >, <, >=, <=. For example, [Campaigns.Discovery Test] AND [Campaigns.Display Test]


Examples of valid when statements

AND

Use AND to include multiple parameters in the valid when statement.

  • Example: [Campaigns.Discovery Test] AND [Campaigns.Display Test]

  • This valid when statement enables campaigns if both feature flags are toggled on.

OR

Use OR to include both a data source and a feature flag.

  • Example: [Campaign Channels] CONTAINS_ANY Search OR [Campaign Channels.Search]

  • This valid when statement enables campaigns if either the data source tag [Campaign Channels] includes Search or if the [Campaign Channels.Search] feature flag is toggled on.

CONTAINS

Use CONTAINS to check whether a tag's value exactly matches a specific value in a list. The tag must return a list of individual values, and one of those values must be an exact match.

  • Example: [OEM Campaign] CONTAINS Search

  • This valid when statement enables campaigns only if the [OEM Campaign] tag returns a list that includes "Search" as an exact value. For example, ["Search", "Display", "PerformanceMax"]

Important: CONTAINS works differently here than in data filters. In valid when statements, CONTAINS performs an exact match (the list must include that precise value). In data filters, CONTAINS performs a substring/partial match. For partial matching in a valid when statement, use CONTAINS_ANY instead.

CONTAINS_ANY

Use CONTAINS_ANY to check whether any value in a tag's list partially matches (contains as a substring) a given value. Matching is case-insensitive.

  • Example: [OEM Campaign] CONTAINS_ANY [inventory.make]

  • This valid when statement enables campaigns if any value in [OEM Campaign] contains the specified make from [inventory.make] as a partial match. For example, " Ford Search" would match "Ford"

Note for data filter users: CONTAINS_ANY in valid when statements behave the same as CONTAINS in data filters—both perform substring/partial matching.

CONTAINS_ALL

Use CONTAINS_ALL to check whether all values in a tag's list contain a given substring. Every value must match. This is a stricter version of CONTAINS_ANY.

  • Example: [Features] CONTAINS_ALL Premium

  • This valid when statement enables campaigns only if every value in [Features] contains “Premium.” For example, ["Premium Leather", "Premium Sound"] would pass, but ["Premium Leather", "Standard Sound"] would not.

Note: You can see when a valid when statement is in effect for a campaign by hovering over the robot icon in the Blueprint column in Manage.

Did this answer your question?