Sending data to the GTM Datalayer
Discover how to push A/B testing and personalization variables from Umbraco Engage to the Google Tag Manager (GTM) data layer in Razor templates.
Umbraco Engage provides a partial view that pushes variables related to A/B testing and personalization to the Google Tag Manager (GTM) data layer.
The following variables are pushed:
inabtest: true
- if the visitor participates in an active A/B test on the page; otherwisefalse
.
This will also be true if the visitor is assigned to the "A" variant which is the original page.
abtestname
- The name of the A/B test the visitor is participating in. If there is no active A/B test, the value will benull
abtestvariant
- The name of the A/B test variant assigned to the visitor. If there is no active A/B test, the value will benull
personalized: true
- If personalization is applied to the page for the visitor; otherwisefalse
.personalizationname
- The name of the active personalization. If there is no active personalization, the value will benull
.
To render the partial view in your Razor template, use the following line:
This partial will render the following output:
Last updated