Knowledge Base: Push notifications

  • Updating visitor language, sending multi-language notifications

    If your website uses one domain with several languages, and you want to send the same Web Push Notification to everyone, but with each subscriber receiving the message in his own language, read more below.

    For each visitor you can manually set his language setting by customizing MaxTraffic tracking code. For example - if a visitor is viewing your website in Estonian language, you can set "Estonian" as his language, and later - if you send a Web Push notification to your subscribers and also add an Estonian translation - then this specific visitor will receive the Estonian version of your

  • Integrating Push Notifications

    Go to Settings > Websites

    Then click on Get Instructions

    1. Install Tracking Code

    Make sure that MaxTraffic tracking code is placed in all pages:

    2. Upload Web Push File

    Then click on "Upload Web Push File" and download sw-mt.js file: it needs to be placed on your website root folder. If you have copied the file to root folder, then you should be able to access the sw-mt.js file by opening https://www.website.com/sw-mt.js (just replace website.com with your own domain).

    3. Verify you have an active Push Prompt

    Go to Web Push > Prompts, and make sure that you have at

  • Using tags for Web Push Notifications

    Want to send Web Push Notifications only to some specific group of your website visitors? You can do that by using tags.  

    To use this feature, you need to modify MaxTraffic tracking code. By default it looks like this:

    If you want to add or remove tags, please use addTag or RemoveTag functions:

    Correct use of addTag, removeTag

    addTag/removeTag can be called once or many times, only new unique tags will be added. Tags are case insensitive, example: "Super User" is transformed to "super user" Tag max length is 36 chars. If tag length exceeds 36 chars, chars after 36

  • Using your own data (traits) to create custom segments

    Want to send Web Push Notifications to segments that are created based on your own data about your clients? You can do that by using Traits and Javascript API. 

    Define user traits (custom fields) 

    1. In e.maxtraffic.com go to Settings > Website Settings > Trait mappings

    2. Click on "Define new trait" button to add new user trait (custom field)

    3. Fill out details about each user trait (custom field) that you want to use:

    IMPORTANT: make sure to use correct data type and name field - after you have saved trait, later it will not be possible to make

  • Can I place Push file in custom folder?

    By default we ask website owners to copy Push file to their main (root) folder, so that are available from:

    How to place push file in custom folder?

    For example, if you would like to place file in https://www.website.com/media/ folder or any different subfolder that is possible as well. In this case then you need to follow these instructions:

    1. Upload file to server.

    Copy the sw-mt.js file to your /media/ folder (or change /media/ to the folder you would like to use). So that they would be available from:

     

    2. Update the MaxTraffic tracking code.

    If your website ID

  • Enabling Web Push support for Safari

    To enable Web Push support for Safari browser, please prepare following info and send it to support@maxtraffic.com:

    1. Website name

    Website name will be shown to visitor in the Prompt that asks for permission:

    2. Website logo

    For Safari users you need to prepare website logo in 256x256px size. Image format should be PNG - it can be transparent as well.

    How will Web Push notification look like on Safari?

    Example of Safari message:

  • How to use API to send personalised Push Notifications?

    1. Pass data about userID to MaxTraffic tracking code

    If your website ID is 1234, then by default MaxTraffic tracking code will look like this:

    To use API, you need to customize the MaxTraffic tracking code by setting userId parameter:

    So if your website visitor is logged in and you know his userId, then tracking code will look like this:

    Don't forget to replace 1234 with your website ID, and 123456789 with userId.

    Note: if you don't know the userId (for example, user is not logged in), then use the default tracking code version (without setting the userId parameter).

    2. Get

  • How to check if visitor has subscribed to push notifications?

    With MaxTraffic you can create special offers (daily bonus, promotions with additional discounts, etc.) for those users who have subscribed to Web Push Notifications. That gives an additional incentive for visitors to subscribe to your sites Push Notifications, and you will be able to reach much wider audience when sending them.

    To get started, you need to modify MaxTraffic tracking script:

    1. Passing userId to MaxTraffic

    By default your tracking script will look like this (we use 999 as your website ID in this example):

    If a visitor has not logged in your system, then you need to keep the

  • How to send Cart Abandonment notifications?

    1. Save info about products added to cart

    When a visitor adds a product to shopping cart, you need to save MaxTraffic Visitor ID, product ID and date in your own database. You can create a table shopping_cart_tmp with 3 columns: MtVisitorId, ProductId, date

    To get MaxTraffic Visitor ID, use following script:

    So when someone adds a product to cart, you need to execute script similar to this one:

    2. Delete info from DB, if product is removed from cart

    If visitor removes any product from his shopping cart, you also need to delete it from shopping_cart_tmp table.

    3. Delete info

  • Sending Push Notifications when products become available

    If your website has products that sometimes are out of stock, you can send a Push Notification to visitors who were interested in the specific product and asked to inform them when it becomes available.

    1. Check if browser supports Web Push?

    You need to verify if visitor's browser supports Web Push Notifications. If it does not, then you can ask him to use a different browser (Chrome or Firefox, for example), or just hide this feature. To check it, you can use our library: 

    2. Get visitors ID

    To subscribe visitor to your product updates, you first need to get his

  • Importing Web Push subscribers

    Due to the way Web Push works, you cannot migrate data from one service to another. We suggest that you install MaxTraffic onto your site. Then send a message to your existing subscribers to get them to come back to your website.

    Any user who subscribed before will be automatically resubscribed when they revisit your site with MaxTraffic installed.

    How will this transition work?

    You need to remove old service provider codes - stops you from collecting database there but still allows to send messages to existing subscribers. Add MaxTraffic codes - will allow you to start collecting subscribers into MaxTraffic and send

  • How to get your visitorId?

    If you get asked from our support team about your visitorId, you can get it by following these steps:

    1. Open website in your brower

    Open the website for which you want to check the visitorId.

    2. Open Console in your browser.

    For Chrome it can be done by clicking View > Developer > JavaScript Console. 

    3. Copy & paste code in Console

    Copy the code below and paste it in Console:

    It should look like this:

    After you have pasted the code, press Enter

    4. Get your visitorId

    Your visitorId will appear and look similar to "0febcfd09bda3ca3bf3a01c207635f9b" - copy