Pushpad
Articles › Pushpad, Sending Notifications, Web Push Notifications

Multilingual notifications with Pushpad

  • # targeting

It's easy to create segments based on the user preferred language. In this way you can send different notifications to users with different language preferences.

First you need to track the user preferred language using the Javascript SDK:

// all the tags that you want to associate to the user
var userTags = [];

// add preferred language to the tags
var userLanguage = window.navigator.language.split('-')[0]; // e.g. "en"
userTags.push(userLanguage);

// include the tags when you call the subscribe method
pushpad('subscribe', function () {}, { replaceTags: userTags });

Then you can send the web push notifications in different languages. For example, if you want to send a notification in Italian and in English, send a notification in Italian to the browsers that have the tag it and then send a notification in English to the browsers that have the tag en.