Skip to main content
All CollectionsADTRIBA CORESet up ADTRIBA CORE
How to deal with Single Page Applications
How to deal with Single Page Applications

In this article you can learn how to integrate Adtriba in your page if you are using a Single page application on your website

János Moldvay avatar
Written by János Moldvay
Updated over a week ago

What is a Single Page Application?

A Single page applications (SPA) is an app that works inside a browser and does not need page reloading during its usage. There are many examples of SPAs around the internet that you use every day, such as Google, Gmail, Maps, Facebook, Twitter or GitHub etc.

A SPA is especially good for responsive websites which support mobile devices, Tablets & Desktop browser. Single page applications can improve a performance in many ways and that's the reason why the get more common everyday. 

Why can SPAs be a problem for Adtriba? 

Adtriba uses the page referral to distinguish traffic. Once the referrer changes during a visit on the website Adtriba thinks: Oh, here is a new touchpoint for the customer journey!

Let's assume you are clicked on a Google Search link to get to yourwebsite.com
In that case, once you hit the website your referral will be: google.com and Adtriba knows your click was triggered by SEO. 

Once you navigate from the first page the trouble basically starts in most SPAs as - for most basic SPA set ups - the referral is not persisted and is empty on your second pageview. In that case Adtriba thinks - oh there is a change in the referral, and it's empty now - thus Adtriba will count one direct touchpoint even though thats not the case. 

How to solve the problem? 

Option 1)

This is the preferred option as in most of the times this solves the problem right away and it's easy to implement.

Just fire the main pageview-tag only on the entry page of your website and on the conversion confirmation page. This will solve any issues in switching referrals while browsing the website.

Option 2)
The main problem for SPAs is that the referrer will be empty at some point or switches from being empty to be filled with a self-referral. For Tools with a session concept this is maybe not an issue but for us, as we count all new 'entries' regardless a session-concept causes trouble. Hence please tell your IT to make sure that the referral, once the user leaves the landingpage of its visit, is not empty but the domain of your website. You can use the extension of the pageview snippet below to overwrite the referral with the domain value.

<script type="text/javascript">
(function(){
    window.adtriba = window.adtriba || [];
    window.adtriba.push(["pageview", "", {
        location: "https://example.com/new-location",
        referrer: "https://my-new-referrer.com"
    }]);
})();
</script>

If you need any further help you can always contact us via support@adtriba.com

Did this answer your question?