Forum Stats

  • 3,678,176 Users
  • 7,778 Discussions
  • 13,052 Comments

Discussions

data.layer push to pass an event into Google tag manager

Hey everyone, I am trying to use a data.layer push to pass an event into Google tag manager when someone has successfully submitted an Eloqua form on our wrodpress webiste. I have used the following code:

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

The problem I am having is that the event is pushing into Google tag manager before the form is completed. How do I add a rule to only fire the tag once the form has been successfully submitted.

Tagged: