AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
2K members online now
2K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Google analytics always shows 1 page view per user even when users access multiple

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

Our wordpress blog trumpetandhillarious.com uses Panel theme - https://wordpress.org/themes/panel/

 

The blog has only two pages – 1. Home 2. Contact Us

 

Home page is where the comic strips are displayed. Every time we add and publish a comic, it will get its own URL. (But its not a separate wordpress page or post). So when you click on ‘First’, ‘Next’, ‘Previous’, ‘Last’, ‘Random’ buttons on the comic panel, different comic strip is loaded with its own URL in the address bar.

 

We started tracking page views using Google analytics – implemented the code in header.php so that its available across the site (no matter which page, which URL on trumpetandhillarious.com).

 

But it seems, google analytics is not tracking/counting the views to different comic strips. It always shows pageview per user = 1 whereas other data, such as session duration, suggests that users must be going through more than one strips (hence more than one URL).

 

We contacted wordpress community for Panel theme. But got the response that it has to do with how Google Analytics tracks it.  What could be going wrong ?  What do we need to change ? Appreciate any help!

 

Thanks!

1 Expert replyverified_user

Google analytics always shows 1 page view per user even when users access multiple

Top Contributor
# 2
Top Contributor

Hi :-)
have you tried placing the tracking code before the closing </head> tag in the active theme's header.php file.
Atm it is after the GTM container code snippet which is after the opening <body> tag.

Incorrect placement of the tracking code can affect its ability to correctly track and report data.

 

Once you have tried relocating it.. and assuming you are not blocking your own visits from being tracked, I would visit the site (not while logged into WP admin) and a number of the various pages to see if they are being tracked correctly via the Real time > Content reports.

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Google analytics always shows 1 page view per user even when users access multiple

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Bronwyn,

 

Thanks for response. We added GTM just yesterday as we are trying to find out a solution to our problem. We thought of tracking button clicks as pageviews, as we suspect, are not tracking correctly.

 

The problem has been there before adding GTM.

 

Google asked to add analytics the code sinppet after the body tag in header.php. That's why we included it there that time.

 

We will try including it in the header instead of after-body tag. (yes, will unblock own visits before testing the change).

 

One question, if you don't mind. Will analytics data for current pageviews be available after every 24 hours ? We see values in 'realtime analytics' but don't that getting updated under Audience-overview immediately. So wondering when should we look at data to verify the changes we will make today ?

 

Thanks again for all your help.

 

Thanks.

Re: Google analytics always shows 1 page view per user even when users access multiple

Top Contributor
# 4
Top Contributor

Hi :-)
re google stating to add it after the opening <body> tag. It does state that for php when using a php include file.
Having said that.. WordPress is a content management system and has its own methods for how things should be done.
The instructions given by Google are pretty generic, so you should always follow what is best/recommended by the specific platform you are working with.

 

Working with WP on an almost daily basis, can i make a couple of suggestions.

Do not edit your current active theme's files. It goes against WP best practices. If the theme gets updated, any of your code changes will get overwritten and removed. It also makes it easier to break your site if there is a coding error.

Either create a child theme for making code edits to your theme.. or create a plugin for your custom functions such as adding the tracking code. This will ensure it doesnt get removed, overwritten etc and wont mean poking around in and editing theme files.. or add one of the freely available plugins for this purpose from wordpress.org

I'm not affiliated with the following plugin at all however I have used it numerous times in the past without any issues. It will ensure it is added correctly to your site in the required manner.. and will also offer some other pretty handy configuration options
https://wordpress.org/plugins/google-analytics-dashboard-for-wp/

 

 

 

 

 

 

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Google analytics always shows 1 page view per user even when users access multiple

Top Contributor
# 5
Top Contributor

Also just a heads up too.. the installation for the GTM container tag has now changed as well
Make sure to clear your cookies and then log into GTM and get the new code. it is now in two part.

the script part of the code goes before the closing </head> tag.. the noscript part of the code now goes

after the opening <body> tag

 

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Google analytics always shows 1 page view per user even when users access multiple

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Thanks. Yes, we do have child themes for CSS but didn't have to change anything in header.php except adding Google code, so didn't think of doing it then. But will explore that now.

 

Yes, as you mentioned, got two parts with GTM. But for GTM, we are using a plugin. Will be removing GTM for now to see if placing the code in header instead of body will work.

 

Thanks again.

Re: Google analytics always shows 1 page view per user even when users access multiple

[ Edited ]
Participant ✭ ✭ ✭
# 7
Participant ✭ ✭ ✭

Great advice @Bronwyn V. Smiley Happy

 

I would add only one thing. @Elite M it seems like if the user clicks links and interacts with the page, subsequent content is loaded dynamically and the full page requests are not made. It basically means that pageview hits are not being sent to Google Analytics.

 

I guess, that's the problem. What do you think Bronwyn?

 

EDIT: Seems like Google Analytics tag is firing twice on the contact page for the same UA number as well: http://trumpetandhillarious.com/contact/

 

Taavi

Re: Google analytics always shows 1 page view per user even when users access multiple

[ Edited ]
Top Contributor
# 8
Top Contributor

I agree with you @Taavi Kalvi  re the dynamic loading of pages.

Regarding the contact page.. the other tags are 3rd party via iframes for the tumblr buttons,

they are unrelated to the GA property tracking the website.

 

The pageview tracking can be made to work using GA Autotrack urlChangeTracker
https://github.com/googleanalytics/autotrack/

 

1) I would uninstall the GTM plugin as its not being used at this stage and is adding unnecessary code to your site.

2) Remove the GA tracking code you currently have installed in the header.php file for property UA-83994063-1

 

3) I've created a quick basic plugin for you to add the necessary modified tracking code and other files necessary to use autotrack 
I've already added your tracking id UA-83994063-1 to it for you

I tested this with the same theme and one of my test tracking ids on a dev setup and it did work.
Having said that. I didnt have any other plugins installed apart from jetpack which is necessary for the theme to work correctly for adding the comic strips.
One thing that was a little funky when i tested is that the page titles did not always match the page title for the URL

Also not sure how the loading img that appears when a page is loading on your site is going to affect anything either.

4) Download the zip file and upload it via the plugin upload option in WP Admin

Once you install and activate it, give it a few hours... real time can take up to a couple of hours to become aware of tracking changes.
https://drive.google.com/file/d/0B2HZe_ztYK_fdXh1eG5QVzZOaTA/view?usp=sharing
 

eta..

Files included in the plugin zip file- 
ga_autotracking.php

 

<?php
/**
 * Plugin Name: Panel Theme GA Comic Strip Tracking 
 * Description: This plugin adds Google Analytics Autotracking for dynamic pages to track the comic strip changes in the Panel theme
 * Version: 1.0.0
 * Author: Bronwyn Vourtis
 * Author URI: https://plus.google.com/u/0/+BronwynVourtis
 * License: GPL2
 */
add_action( 'wp_enqueue_scripts', 'bv_enqueued_assets' );

function bv_enqueued_assets() {
	wp_enqueue_script( 'bv-gascript', plugin_dir_url( __FILE__ ) . 'js/gatracking.js' );
        wp_enqueue_script( 'bv-analyticsjs', 'https://www.google-analytics.com/analytics.js' );
	wp_enqueue_script( 'bv-autotrackscript', plugin_dir_url( __FILE__ ) . 'js/autotrack.js' );
}

 

js/gatracking.js

window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
  ga('create', 'UA-83994063-1', 'auto');
  ga('require', 'urlChangeTracker');
  ga('send', 'pageview');

 

js/autotrack.js from https://github.com/googleanalytics/autotrack/blob/master/autotrack.js

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Google analytics always shows 1 page view per user even when users access multiple

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

Thanks @Taavi Kalvi. Will look into it.

Google analytics always shows 1 page view per user even when users access multiple

Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭

Thanks @Bronwyn will check this today