How to Track Subscription Request Display, Exit, and Clickthrough Events
Collect additional information about user behavior using web push notifications. You can track how many users receive, open, and click your subscription requests. This will help you understand how effective your settings are and which topics or formats are interesting to users.
You can track the following events:
- subscription request display;
- subscription request exit;
- subscription (clickthrough).
Once your web push notification events are triggered, you can track when and where users receive your notifications, as well as what actions they take after receiving them. For example, you can use Google Analytics to track web push notification opens, clickthroughs, and conversions.
You can also add additional information to your web push notifications. For example, you can notify users about new product or service launches, discounts, promotions, or other important events.
Add a script to your web push notification page that will be triggered by your selected event before the closing </body>
tag.
You can add the script in the "Custom Code" tab in the settings of your SendPulse-powered website. Read more: How to Add Custom Code to Your Site.
An example of code that tracks subscription request display events:
let bodyElem = document.getElementsByTagName("body")[0];
bodyElem.addEventListener("spPromptShowEvent", function(e) {
console.info("Event: ", e);
});
An example of code that tracks subscription (clickthrough) events:
let bodyElem = document.getElementsByTagName("body")[0];
bodyElem.addEventListener("spPromptSubmitEvent", function(e) {
console.info("Event: ", e);
});
An example of code that tracks subscription request exit events:
let bodyElem = document.getElementsByTagName("body")[0];
bodyElem.addEventListener("spPromptCloseEvent", function(e) {
console.info("Event: ", e);
});
You can add all three events or just one.
Last Updated: 28.11.2023
or