How can I work with GTM and Google Analytics to track events and target users with Web Push Notifications?

First Make sure you have completed the Google Analytics integration for your project.

You can use Google Tag Manager to create and publish triggers and tags that allow you to track events such as button clicks on your site. You can then create segments in Google Analytics to target users who meet certain conditions related to these events. For example you may want to track users who are clicking an "Add to cart" button on your site but who are not clicking the "Checkout" button. Below is a sample workflow of how you can start tracking an event and then target users with xtremepush.

In this example we will look at triggering an event when the user clicks a specific button. On our example site we have a Take Action button.

 

If we inspect this element it has a link that references "/take-action-bedford/". 

 

 

Next we will go to google tag manger to create a trigger and tag to track this event. First we need to add a new trigger.

 We navigate to triggers and click new. Our new trigger should have a suitable name like "Take Action clicks". The event type should be Clicks, and we will configure the trigger to target All Elements. The really important setting to make this trigger fire when the button is clicked if the fire on condition. In our example we use a condition based on the link the click is targeting shown earlier - "/take-action-bedford/".

To fire this trigger when the Take Action button is pressed we have added a condition based on the click url as shown above -  Click URL contains take-action. This will fire when users click on our button as it's link "/take-action-bedford/" contains take-action. We now save this trigger for use in a tag that will track take-action events and navigate to the tags section of google tag manager.

Here we can click new to create our new Take Action Event Tag.

After clicking new we can give our tag a suitable name like "Take Action Event". You should choose Google Analytics as the product, with Tag Type Universal Analytics. Set the tracking ID to your google analytics ID. Track Type could be set to Event, category should be something suitable, in this example we are categorising this event as a Nav event. We have chosen an Action name we will recognise TakeAction, and we are using the  {{Click URL}} as the label.

 

 

In the fire on section we will use the custom event we created earlier when you select event you will get a pop where you can choose it.

 

Once you have added the correct trigger you can save your Tag. The only other thing to check before we publish our changes is our enabled variables. We are using some click variables in our trigger and our Tag so we should navigate to the variables section of tag manager to check that these are enabled as shown below.

Now when we publish our Google Tag Manager changes and got to the sample site and click the Take Action button we can see Take Action events in Google Analytics. For example after clicking the take action button if we go to Reporting > RealTime > Events we can see our TakeAction events recorded in Google analytics.

We can now create a Google analytics segment using this Event as in the example shown below.

 

If you set this segment up correctly as described in our docs here it will be available for targeting users in the segmentation section when creating a campaign on xtremepush:

 

 

 

 

 

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.