Mobile app version of vmapp.org
Login or Join
Megan663

: Google Analytics - How can I track pageviews of only the pages which have a specific in them? I have a website that's a collection of articles. The longer articles have a 'middle' < div

@Megan663

Posted in: #GoogleAnalytics

I have a website that's a collection of articles. The longer articles have a 'middle' < div > about halfway through the text, where I can insert ads or whatnot. Shorter articles and miscellaneous pages don't have this < div >.

I'm trying to figure out how to track how many pageviews I get only on the articles with the 'middle' < div >. Does anyone know how to do it?

*Note that I just want to see how often the articles with that < div > are loaded. I don't care about whether the user specifically scrolls down far enough to literally see the < div > or whether they interact with it in any way.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Megan663

1 Comments

Sorted by latest first Latest Oldest Best

 

@Karen161

A custom dimension is the right answer here. You can create the custom dimension and scope it to hit. Then, before the pageview send in Google Analytics, you'll want to detect if that <div> is present (either by the template or specifically with a JS selector to check its .length) to set the value of the custom dimension (which can either be a specific string for every one, or a dynamic string based on the div content/attributes).

Then in Google Analytics, you can create a segment based on traffic to pages with that particular div. Or just use secondary dimensions in existing reports to access the data.

Now (and I know you didn't ask for this), if you did want to get additional information I'd recommend checking out the impressionTracker in Autotrack.js where you would send events (and custom metrics) to determine how often that particular <div> was actually seen by users. I just wanted to include that info for future consideration (and for anyone else that finds this question and is curious).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme