Tracking Language from Single Page Application to Google Analytics

134 Views Asked by At

We have a website that is a single page application. We have an issue where, in Google Analytics (via DTM), we cannot track adequately the journey across our site based on the user’s language. The tracker is loaded on the first page viewed by the user within that session – subsequent page views, the tracker is not loaded but the pageview tag is fired on page load. Importantly, our Google Analytics rules in DTM is configured as JavaScript / Third Party tags and not Google Universal Analytics.

We have a situation where the initial page is passed as, for example, www.ourdomain.com/fr (for the French language site, but for subsequent pages this is not carried forward, so we have a break in the journey where all visits are being assigned to www.ourdomain.com/pagepath

We do have a query string that passes in the URL that includes the parameter/variable “Language” i.e. www.ourdomain.com?language=FR and also this information is passed in the data layer using the format language: “fr-FR”.

I was wondering if there was any best practice around passing this information, presumably from the query string to help set the page path in Google Analytics via DTM (bearing in mind this is a SPA) the outcome I would like to achieve would be to insert the parameter from the URI/URL (as it is passed in a better format) after before the subsequent page path i.e. /{{language}}/book/results or /fr/book/results instead of /book/results, for example.

Any help with this is much appreciated, I am naïve with DTM.

0

There are 0 best solutions below