How to pass additional variables for segmenting and personalizing of web push notifications

To pass additional variables like subscribers' names or emails, after adding web push integration code to your website (the code generated in your account), you need to add the additional code.

Method 1. Via window.addEventListener script

<script type="text/javascript">
window.addEventListener('load', function() {
    oSpP.push("Name","Name_of_website_user");
    oSpP.push("email","Email_of_website_user");
});0
</script>

After an anonymous user subscribes for web push notifications if this user generates information related to a variable you collect (e.g., entering their email address), the data is transferred to the server when this user revisits your site.

Method 2. Via Hidden Input Fileds

Another method to upload additional variables to your SendPulse account is to add to your website other input fields with sp_push_custom_data class.

<input class="sp_push_custom_data" type="hidden" name="Variable 1" value="Some data1"> 
<input class="sp_push_custom_data" type="hidden" name="Variable 2" value="Some data2">

Where Variable 1 and Variable 2 are appropriate variables for personal data about a subscriber. For example: Name, Last name, Email.

You can add as many lines with variables as you want, the data from them will be added to subscribers’ records in the web push service. That data will be used for personalization and segmentation of messages.

Both methods described above are applicable for all sites on any CMS.

    Rate this article about "How to pass additional variables for segmenting and personalizing of web push notifications"

    User Rating: 4 / 5 (7)

    Previous

    How to add web push notification code to a website using Google Tag Manager

    Next

    How to Track Subscription Request Display, Exit, and Clickthrough Events

    Popular in Our Blog

    Start using SendPulse web push service today — it's free