Cris
Cris

Reputation: 4044

Universal Analytics Google - Pageviews

I'm trying to record the hits for each author of a blog site.

ga('send', 'pageview'); (in the header with the ga code to track each page)
ga('send', 'pageview', { 'dimension1': 'William' }); (only on blog pages, I want to record the hits of each author)

Unfortunately, due to the templating of the site I can't just use ga set then send the pageview.

Will I get 2 hits for each page load, therefore showing incorrect data in Google Analytics?

Upvotes: 1

Views: 178

Answers (1)

Suketu
Suketu

Reputation: 369

Yes, you will get double page views which is incorrect. However Can you put your code in if else mode?

if(currentPage != 'blogpage') //put your conditions identifying if it's blog or not
{
     ga('send', 'pageview'); (in the header with the ga code to track each page)
}else
{
    ga('send', 'pageview', { 'dimension1': 'William' }); (only on blog pages, I want to record the hits of each author)
}

Upvotes: 1

Related Questions