How to reassuringly monitor a user-defined GTM var "purchase" has an unexpected value = X?

17 Views Asked by At

I want to get notified when a user-defined GoogleTagManager var "purchase" sends a new and unexpected value = X which is different than the regular Y.

Is there a way to do so?

  1. Writing the historic values of var "purchase" to a spreadsheet - is it possible?
  2. Using a ready template code (I saw one named "value monitoring") - but I understand this is for logging to the browser console only?
  3. Sending the value of this specific even to some endpoint - I think it's possible only from an html tag? Or is it possible from the GTM code-template as well?
1

There are 1 best solutions below

0
Mykola Nazimkov On

You can use variable purchase into Tag Manager's trigger. When some events fire and purchase value equals = Y then you send an analytics event. But if the value of "purchase" changes without an event (like click, download page, page view) send analytics event possible in DataLayer JavaScript.

<script>
if(purchase === Y) {
window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({'event': 'new_event'});
}
</script>

enter image description here