How to set up goal tracking using Google Tag Manager

Lisa Fockens Updated by Lisa Fockens

Important note

To make goal tracking works properly, you'll have to make sure that your "Wisepops setup code" tag is fired before the "goal" tag.

To do so, open the "setup code" tag in Google Tag Manager, click "Advanced settings" and set the priority of the "setup code" tag to 1:

In this tutorial, we'll assume you have a confirmation page associated with your goal.

If you don't, please contact us, we'll suggest a different method.

Step 1:

Log in to your GTM account.

Step 2:

In the left menu, click "Triggers" and then "New".

Step 3:

Configure your trigger:

  • Type: Dom Ready
  • Fire on: Some DOM Ready Events
  • Page URL: input your confirmation page
  • Choose an explicit name for your trigger

Step 4:

In the left menu, select "Tags" and click "New"

Step 5:

In tag configuration, select "Custom HTML"

Step 6:

In the HTML field, paste the following script and customize it:

<script>wisepops("goal", [goalName], [goalValue]);</script>

[goalName] and [goalValue] should either be replaced by variables that makes sens to you, or omitted. You can refer to the Goal tracking documentation to learn more about them.

This is what it looks like in our case (note that I don't want to assign a value for goal completions):

Step 7:

In triggering, select the trigger you just created.

Step 8: 

Save and name your new tag.

Step 9 

Preview the changes to make sure the tag is triggered on your confirmation page.

When you're done, hit "PUBLISH".

How to Set Up Goal Tracking in Magento