Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics and Angular4+ matrix URL parameters

In my Angular4+ app, I'm using matrix notation for URL routing params. Google Analytics strips URLs up to first encountered ';'. I found this but it doesn't help much.

Is there a way to make GA read full URLs like this or my only option is to turn them to queryParams?

like image 919
Mike Avatar asked Jan 03 '18 13:01

Mike


1 Answers

Google Analytics has always offered means to force the page path being collected to an explicit value, overriding the default parsing based on location.pathname+location.search

Just set a value for the page parameter.

You'll find an example here https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications

However, first check which version of the Google Analytics tracker code you are using, to get the right syntax applicable to that version. Or prefer to push the value to Google Tag Manager, through a dataLayer.push('pagePathVariableName','/example-page;field1=value1;field2=value2;field3=value3'); call and do the mapping in GTM

like image 155
Open SEO Avatar answered Oct 07 '22 16:10

Open SEO