Discussions

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

User_Z5U0D
User_Z5U0D Posts: 4 Red Ribbon

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:
Sign In or Register to comment.