JS Variable criterion

This article will show you how to use this Trigger criterion.

JS variable is a triggering criterion that enables defining a segment.

To learn how to create a segment, please refer to this article.

📖 Definition

The weather criterion enables you to verify a specific JS variable of your choice.

🔎 How does it work?

Our tag is doing window.variableName to search for a specific variable like anyone could do through the browser console.

⚙️ Configuration

You will need first to configure the right operator ABTasty will have to look after. Only two are available on that use case: is and is not.

Once you have made your choice, you can declare the variable, ABTasty will have to look for when parsing the DOM of the page. It has to strictly respect the naming convention that you used to be able to securely detect it.

Then, you have to choose from a second operator list. Depending on the type of data your JS is manipulating, you can either choose:

  • “Equals”

  • “Contains”

  • “Is regular expression”

  • “Lower than” (strictly)

  • “Higher than” (strictly)

  • “Is declared”

To finalize your configuration, you will need to declare the right variable value you are expecting to have to fire the campaign.

The JS variable criteria allows you to mix up different variables with both a some and all calculation approach, giving you a wide range of possibilities to create highly personalized triggers.

As your variable could be used and transformed through your visitor navigation, three options are offered to check this trigger at the right moment:

  • When the page loads: means our tag will not be able to check new declared values between two pages visited.

  • Every {X} ms until the conditions are met: meaning our tag will operate a regular check to detect any changes on that specific variable if the condition is not met at tag execution.

  • According to a custom JS event: you can find everything in our developer documentation about the custom event that allows you to restart the targeting verification.

💡 Use case

Let’s imagine that you set up a boolean productInteraction variable in your code base to know if a specific visitor has already interacted with one of your products (for example size, a shipping verification, or anything that could grow your business).

In AB Tasty, you can then create a trigger based on that JS variable, and use it in one of your campaigns to wait for one of these interactions to trigger it.

Need additional information?

Submit your request at [email protected]

Always happy to help!

Ali_love.png

Last updated

Was this helpful?