How to do Dynamic Segmentation in PushEngage With Google Tag Manager

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.

  1. Create a New Trigger -> Features URL Trigger in GTM
  2. Configure the Page URL pattern using RegEx, or any other mechanism.
    custom-firing-on-featured-url
  3. 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

feature-url-trigger-usong-GTM-for-pushengage

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.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Engage and Retain Visitors AfterThey’ve Left Your Website

Increase the value of every web visit with Push Notifications that are hard to miss.

  • Forever Free Plan
  • Easy Setup
  • 5 Star Support