Notice: There is no legacy documentation available for this item, so you are seeing the current documentation.
Google Tag Manager can make segmentation easy for you to add on specific events. Rather than adding or making changes to the codebase, you can add specific tags to events based on your use case.
You can use the below code snippet to be added on a button click, image click or form submission. This code ensures that you can place them into a tag and then trigger it on a specific event.
You have to ensure that the segment is already created in the dashboard. For creating Segments, please navigate to Audience > Segments in PushEngage Dashboard. Copy the same segment name and use it in the code. For example, if your segment is called ‘Form Submitted,’ the code would look like this –
window._peq.push(["add-to-segment", "Form Submitted"]);
Dynamic segmentation is different from regular segmentation. Here you can specify the number of days you want the subscriber to remain in the segment, after the defined duration it will be automatically removed.
<code>var days = 5; window._peq.push(["add-to-dynamic-segment", "segmentName", days]); </code>
You can refer to more details about dynamic segmentation here.
Now, we will understand how to add this segmentation code to Google Tag Manager.
Adding the code to the Tag
You can open the container and navigate to the Tags section > Click on the New Tag button in the right corner.
Adding the Trigger to the Tag
Create a New Trigger and configure the Trigger based on your use case. You can use the Page URL pattern or an element ID.
There are various methods to use Trigger you can use an existing Trigger available or the one mentioned in the list.
Below is an example to use the Page URL Triggers –
Once you have added the Tags and Triggers, you can review and publish them changes.
That’s all we need to do to set up segments using Google Tag Manager. Once the subscribers become a part of this segment, you can start targeting them with contextual campaigns.
If in case you run into any issues, please feel free to contact us by clicking here. Our support team would be able to help you