Untitled

 avatar
unknown
plain_text
3 years ago
481 B
8
Indexable
<script>
window.addEventListener("message", captureEvent, false);
function captureEvent({data}) {
   if(typeof (data) === 'object'){
      const action = Object.keys(data)[0];
      const label = Object.values(data)[0];
      // you could add an if statement to check if action == "booked" here
      dataLayer.push('send', 'event', {
         eventCategory: 'Chili Piper',
         eventAction: action,
         eventLabel: label,
         eventValue: 1
      });
   }
}
</script>
Editor is loading...