Rockerbox UID to GTM Data Layer

If you need to use the Rockerbox UID in a GTM Tag, you can follow these steps to get that value available as a GTM Variable.

  1. Create a new Tag in GTM with the following HTML:
<script>
var rbuidSet = function(obj){
var rbuid = !!obj && obj.rbuid;
if (!!rbuid) {
window.dataLayer.push({
event: "rbuidSet",
rbuid: rbuid
})
}
}
window.rbuidSet = rbuidSet;
</script>
<script src="https://getrockerbox.com/jpuid?jsonp=window.rbuidSet"></script>

Set the Tag to fire on All Pages.

  1. Create a GTM variable for the rbuid Data Layer variable set above.
  1. Create a Trigger that fires when the Rockerbox UID variable is set.
  1. Finally, use the Rockerbox UID GTM Variable in the Tag that you need.


How did we do?