JS variable is a triggering criterion that enables defining a trigger.
To learn how to create a trigger, 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:
- “Equal” or “does not equal”
- “Contains”
- “Is regular expression”
- “Lower than” or “higher than”
- “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
- 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 product.feedback@abtasty.com
Always happy to help!