Tag values are a key part of targeting content or functionality based on user segments. Within a "dataLayer" implementation, we can effectively tailor content based on specific user characteristics.


How do tag values and dataLayer work together?

A dataLayer serves as an object where we can store information about a user or their behaviour. For example, we use the following code to put user information into the dataLayer in browser console.

window.dataLayer = window.dataLayer || []; 
window.dataLayer.push({ 
   score: 0.7,
   couponCode: 'custom2025'
});

Two properties are stored here:

  • score: the user's score or rating, for example based on their behaviour,
  • couponCode: the coupon code customised for a specific user.


You can set properties (or any different properties and their values you need) in Page & Audience targeting in content settings.


Customizing content with values

We can customize content or features based on these values. For example:

  • If "score" is higher than 0.3, we display content.
  • We can use personalization in the text using placeholders such as {name}, {score} or {couponCode} or any placeholders you like.


Sample personalized content:

Let's show an example where is used {name} and {couponCode}.

With using values from code above in dataLayer, the content can look like this picture:


Practical Uses

Thanks to the articles How to show different product tours to different user segments and User-based targeting condition, specific targeting conditions can be implemented. 


For example:

  • Users with a certain "couponCode" can be redirected to a special product tour.
  • Personalize content based on user segments such as first time or returning customers.


In this way, the user experience can be optimized and the effectiveness of product campaigns can be increased.