Creating Data Layer Variables
Data layer variables empower ClickFlare Tag Manager to extract values from your data layer implementation and transmit them to tags, triggers, and other variables. A data layer object consists of a series of key/value pairs, where each key represents a category of information, such as a book’s category, title, or author. Each key can have various corresponding values; for instance, the key for a book’s title might hold values like ‘Ulysses’, ‘War and Peace’, ‘A Brief History of Time’, and so on.Adding Data Layer Code to Your Web Page
The initial step in setting up the ClickFlare data layer involves embedding the ClickFlare container script into your website. After integrating the script, you can conveniently access the data layer directly from your browser’s console using the following command:window.clickflare.push() command:
Configuring the Data Layer Variable
After identifying the desired key, proceed to establish a data layer variable:- Click on Variables.
- Select + New Variable.
- Choose Variable Configuration and opt for Data Layer Parameter as the variable type.
- In the Data Layer Variable Name field, input the key exactly as it appears in the code (e.g., bookTitle, not book title).
- Save the variable.
- Repeat these steps for each data layer key you wish to utilize as a variable in ClickFlare Tag Manager.
- Publish the container.
Note: Data layer variables operate on a per-page basis. If you desire data layer values to persist across multiple page views, you must implement your own code to transmit data layer values between pages.