Monetate is a powerful A/B testing tool that allows you to use variants of your form that you can then push through to Zuko to analyse your data. Follow the below steps to push through your Monetate variants as Custom Attributes
There are a couple of ways you can do this, either by using Zuko’s data layer, or alternatively by identifying the Monetate variables and pushing these through to Zuko.
The best solution is to set the test variant in Zuko’s attributes data layer. Using the data layer allows the setting of the test variant to happen from within other code happening with the browser. During a visitor’s session to your form, Zuko’s tracking code will then pick it up and add it to the session.
If the test variant is only available with the form code to send the test variant to Monetate, you can follow the below example to push this through as an attribute to Zuko:
// Example of sending the test variant to Monetate
var variantID = 'ABC';
monetate.push(['setCustomVariables', [{
name: 'variant',
value: variantID
},
]]);
// Now, add this attribute to the Zuko data layer
window.zuko = window.zuko || {};
window.zuko.attributes = window.zuko.attributes || {};
window.zuko.attributes['variant'] = variantID;
As you can see from the above example, the Monetate variant has been defined as a variable variantID. This has then been added to the Zuko data layer as an attribute.
Once this has been implemented, you will find the different variants in your filter tab on your Zuko reports:
You also have the option to use the .setAttribute function and add this to your Zuko tracking code. Please note that this solution is only possible if the different test variables are available at the point where Zuko tracking is initiated.
An example of how this looks can be found here:
<script src="https://assets.zuko.io/js/v2/client.min.js"></script>
<script></script>
Zuko
.trackForm({
target: document.getElementById('mailing-list-signup'),
slug: 'YOUR FORM SLUG'
})
.setAttribute('Monetate Test Variant', ‘{{Your GTM Monetate variable}}’)
.trackEvent(Zuko.FORM_VIEW_EVENT)
In the example here, we have given the attribute the key ‘Monetate Test Variant’- this is how it will appear in Zuko.
The variable ‘Your GTM Monetate variable’ should be set in Google Tag Manager. When the Monetate variant is used as defined by the variable, this attribute will be pushed through into Zuko.
Find more information about setting up custom attributes in GTM here.