1

Using Google Analytics, how could I label pages in my site so I can then see individual stats in Google Analytics.

For example, I have over 500 000 pages in the site, and I want to compare the site speed for pages containing ads vs pages that do not contain ads.

At application level I control where I show or do not show the ads, just not sure how to pass that to Analytics, I assume I need to add a html code like: add_page_label('page with ads').

It doesn't need to be ads, for example I would like to label pages as guest visitor vs logged user and compare things like page speed for the two.

I remember I seen Analytics has this exact function but the way to implement it confused me at that time.

1

One of the methods to achieve this would be to use custom dimensions, which allows you to submit additional data, relevant to the tracked pages.

You should create a new custom dimension in Google Analytics for every parameter, you would like to track. Based on your description, this should be a hit-level dimension, as it can vary by every page visited.

Data collection varies by the method you have implemented Analytics (e.g. ga(), Google Tag Manager, gtag.js). For example, ga() method would look the following:

ga('create', 'UA-XXXX-Y', 'auto');

// Set value for custom dimension at index 1
ga('set', 'cd1', 'page with ads');

// Send the custom dimension value with a pageview hit.
ga('send', 'pageview');

For reporting, you can apply this dimensions as secondary dimensions in the basic reports, or you can create custom reports, including only the required custom dimensions and metrics.

For further details, I recommend this support article.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.