Suppose you want to start a new campaign and segment your subscribers on the basis of the page they browsed. How would you do that? You would be firing our Javascript API which simply adds to the segment of your liking. How would you segment push subscribers dynamically, without changing the code?
This is where Google Tag Manager (GTM) comes in handy. Google Tag Manager is a user-friendly solution to managing the tags, or the snippets of JavaScript that send information to third parties, on your website or mobile app. You use the interface to decide what needs to fire and on what page or what action. GTM then adds the appropriate tracking to your site to make sure it all works, and it is one of the best tools for marketers. You can install Push Notification through GTM.
Example – If the URL contains turmeric, then add to segment Turmeric like this –
_pe.addSubscriberToSegment(‘segmentName’);
Here is our step by step GTM guide to fire PushEngage tags/API
Example: If the URL contains Features and is a page that is in a subdirectory below features, we will add the segment Features to the web push subscriber.
- Create a New Trigger -> Features URL Trigger in GTM
- Configure the Page URL pattern using RegEx, or any other mechanism.
- On this Trigger fire a Custom Tag, which has Push Engage code.
Note, please ensure we are firing the correct version of PushEngage JS API. If you have added PushEngage using Legacy code, then use Legacy API. If you have added Push Engage using the Asynchronous code, then use that API.
https://www.pushengage.com/api/js-async-api/
For Async code, the call to add to segment is window._peq.push([‘add-to-segment’,’segmentName’]);
See how to add this code in GTM
That’s all. Now all you’re your subscribers will be segmented based on their browsing patterns. You can then send a relevant notification based on their geolocation, device-browser used during the subscription or the date range.
Once you have segmented your push subscribers, you can even start the different trigger push notification campaigns for different segments.