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.
Want to send Web Push Notifications only to some specific group of your website visitors? You can do that by using segments.
To use this feature, you need to modify MaxTraffic tracking code. By default it looks like this:
If you want to add or remove segments, 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
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
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
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).
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
By default we ask website owners to copy Push files to their main (root) folder, so that are available from:
How to place these files in custom folder?
For example, if you would like to place files 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 files to server.Copy the 3 files 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
If you set up Web Push notifications with Google Cloud Messaging API in https://console.developers.google.com then you need to import your project into Firebase, and then get the new Firebase Server key.
How to import your project into Firebase?
1. Log into https://console.firebase.google.com with your Google account.
2. Click on "or import a Google project"
3. Select the project:
4. Click on "ADD FIREBASE" button.
How to get Firebase API key?
1. After project is imported, click on the Settings icon and then on "Project settings" link.
2. Then click on "Cloud Messaging" link:
3. Now copy the Sender ID and Server key:
1. Add MaxTraffic Tracking code
If you have just created an account and have not used Exit Popups or other products before, then you need to integrate our tracking code in all pages.
More info here: http://help.maxtraffic.com/i20-implementing-codes
2. Upload files to your website.
Go to Settings > Websites
Then click on Get Codes
Then click on "Push Files" and download .zip file: it will contain 3 files that need to be placed on your website root folder. If you have copied files to root folder, then you should be able to access the sw-mt.js file by opening https://www.yourwebsite.com/sw-mt.js (just replace