Mobile app version of vmapp.org
Login or Join
Chiappetta492

: Managing duplicate URLs on e-commerce site with canonical URL and Google Analytics On my e-commerce site I have products which may belong to multiple categories at the same time. Product URL

@Chiappetta492

Posted in: #CanonicalUrl #DuplicateContent #GoogleAnalytics #Magento

On my e-commerce site I have products which may belong to multiple categories at the same time.
Product URL contains categories, so depending on how customer came to the page, we are displaying according category path both in the URL and the breadcrumbs.
Each product in addition has its own product URL without categories in it, and this URL is used in canonical meta tag on all duplicate pages.

Problem here is how my store is tracked in GA: bunch of duplicate urls for the same product are messing up the statistics, so I am thinking to explicitly replace "location" dimension in the tracking snippet with canonical URL value from meta tag (if it is present), and preserve all query string parameters (I am dealing with them separately on the view level). Need to mention, that I am tracking categories using custom content groupings, so, as for me it is OK to disregard category info in the "Page" dimension.

I just want to check with GA professionals if there is anything else against doing so?

Here is the code:

var canonicalUrl = Utils.getCanonicalUrl();
ga('set',{
location: canonicalUrl ? canonicalUrl + window.location.search : window.location
// other custom dimensions
});
ga('send','pageview')

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Chiappetta492

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme