Learn how to send your GTM variables to our SiteData storage, to use our SiteData condition and merge tags.
If you want to send your existing variables to our SiteData storage, you need to create a tag in Google Tag Manager.
To do that, click "New" on the "Tags" page:
Next, click "Choose a Tag" under "Tag Configuration" and select "Custom HTML".
Then, copy this script:
<script>
window['DripOnsite.sitedata'] || (window['DripOnsite.sitedata'] = []);
window['DripOnsite.sitedata'].push({'Your SiteData Variable': GTM Variable});
</script>
And paste it to the field:
Now, you need to replace "GTM Variable" with the GTM variable name you want to send to SiteData.
For example, if you have a variable in your checkout, sending visitors' cart value to your GTM, it could look like this:
Copy this GTM variable name and paste it into the Custom HTML tag from earlier:
Now, replace "Your SiteData Variable" with the name you want to call it when you use it in Onsite.
Now your tag is set up. Next, you need to choose a trigger to decide when your tag will be fired.
To do that, click "Choose a Trigger" right below the section where you added your tag:
For example, in our case, we want to trigger this tag when a visitor enters checkout. So, we made a custom event for that called "Checkout", and we'll use it as a trigger for our tag.
Click "Save" to save your tag.
Next, click "Submit" to submit your changes.
Finally, click "Publish" and set your changes live.
Now you can use this SiteData variable in your Onsite campaigns both as a trigger, a targeting option, and a merge tag. 🎉
To use your SiteData variable as a targeting option, simply visit the Display Settings step of your Campaign Builder and switch "SiteData" on.
Insert your SiteData variable and decide if it should be present, contains, greater than, and so on, for your campaign to show or hide. In our case, we might want to show a campaign when a visitor has over 500 in their cart:
Now our campaign will only show to visitors who have over 500 worth of items in their basket. 😉