How to integrate MaxTraffic in SPA (single-page application)?

To be able to use MaxTraffic with your SPA website you will have to insert three JavaScript codes on your website:

1. Tracking code: it allows us to track your visitor behavior and show them messages. Place our Tracking code across all pages of your website.

2. Conversion code: this script allows us to track conversions. Place our Conversion code on the "Thank you" page where the visitor will be taken after successfully completing a purchase.

3. SPA specific code: this code is used only for websites using SPA technology. You need to execute it each time a visitor clicks on a link inside your single-page application. 

Where do I get the MaxTraffic tracking and conversion codes?

1. Login into your account in e.maxtraffic.com using the email and password that was sent to your email.

2. Go to Settings > Websites

3. Click on "Get Instructions" button 

4. Now you will see the tracking code that you can send to the person, who is responsible for adding it into the website.

5. For Push Notifications you will have to download a file by pressing on "Download File" button

6. At the step 3 "Install Conversion Code" to get the code for Thank you page as well:

How to pass the conversion ID and conversion amount data to MaxTraffic?

Place our Conversion code on the page that the visitors will be directed to, once they have successfully completed the action that you intended them to complete. Usually, this is a "Thank you" page after completed purchase.

Notice that this script has two variables that you should pass to MaxTraffic.
In "conversion_id" pass unique ID. Usually, this is the order or purchase ID.
In "conversion_amount" pass the total value of conversion without any currency symbols.

How to simulate a pageview in SPA (single-page application)? 

If your website is based on SPA (single-page application) you also need to execute an additional JavaScript code each time a visitor clicks a link in your application:

<script>
mt('pageview');
</script>

This code will let MaxTraffic platform know that a new pageview just happened, and you will be able to properly use URL targeting and other MaxTraffic features.