Sep 292013

The Issue

Every now and then, a site running on WordPress will not accurately record Google AdWords visits in Google Analytics.  You may notice that the number of AdWords clicks reported in Analytics is correct, but it records nearly zero visits.  In fact, another symptom is that no Analytics campaign visits (including those campaigns defined using the Google Analytics URL Builder) are being recorded.

The Why

Google Analytics gets all of its visit data from the query string of a URL. ¬†This is the part of the URL that follows the full path, begins with a question mark, and contains a series of parameters (or at least one parameter). ¬†This is most visible when defining a custom campaign – it looks something like¬†?utm_source=newsletter&utm_medium=email&utm_campaign=promo – but, in fact, Google AdWords has been “auto-tagging” destination URLs for enhanced ad performance tracking in Analytics for quite some time. ¬†You may have seen clues pointing to this – the Google AdWords query string parameter is GCLID.

All of the preceding information is important because it gives insight into what can go wrong with this type of tracking.  Every now and then, a WordPress plugin will issue 301 redirects for any URLs containing (unrecognized) query strings, and direct them to the same destination without those parameters.  Because the Analytics tracking code is contained within the page itself, it will only be called after the page loads from the resulting 301, and Analytics will no longer have any query string data to provide insight into the source of the visit.

The Fix

Because this is typically caused by a plugin, fixing it requires changing a plugin setting generally related to permalinks.

  • In the WordPress SEO Plugin by Yoast, the setting responsible for this is the “Clean Permalinks” option, as discussed here. ¬†They seem to have addressed the Analytics tracking issue, while preserving the overall idea, with the advanced option “Prevent cleaning out Google Analytics Campaign Parameters”, documented here. ¬†I have not tested this resolution, and if it does not work for AdWords tracking, then try adding the GCLID parameter to the list of “not to clean” variables.
  • In the¬†404 Redirected¬†plugin, navigate to the plugin’s settings, and select the “Options” tab above. ¬†Scroll down, and near the bottom, disable the “Force current permalinks” setting.

If you notice this happening despite the plugin settings above being correct, it is probably caused by a similar plugin with a similar setting.  To narrow it down a bit more manually, try to disable plugins until you confirm that (replaced with an appropriate page for your site, of course!) returns a 200 status code with the correct page contents, and not a 301 redirect to

Postscript – But the “Clicks” Count is Correct in Analytics?

The avid reader and/or troubleshooter will point out that the “clicks” count is correct in Analytics, so how can this indicate a problem with Analytics tracking? ¬†The answer is that the “Clicks” count comes directly from the Google AdWords click data (as visible in Google AdWords without Analytics even running), which is “shared” to the Analytics platform via Google’s internal data sharing settings. ¬†The issue here is with the data being¬†recorded by Analytics, and that would be the “visits” data.

Jul 252013

If you’ve looked at the “Audience” overview report in Google Analytics lately, you have probably noticed that the primary dimension is no longer “Mobile”, and the rows are no longer simply “Yes” and “No”. ¬†Indeed, up near the top of the page, you can see a note from Google:


Note from Google: “We’ve changed this report. We‚Äôve add Device Category as the primary dimension in this report, so you can see data about the different types of devices visitors uses: Mobile, Tablet, or Desktop. The previous version of this report only displayed a Yes/No option to indicate if a mobile device was detected.”

Google’s primary idea here is to push the use of Advanced Segments to analyze traffic from various devices. ¬†While that option is useful, sometimes it is clearer to simply see an uncluttered comparison of your mobile and non-mobile visitor behaviors – as in the previous version of this report page.

In order to emulate the old report – and, perhaps, even build upon it – we can create a basic Custom Report within Analytics. ¬†To get started, click the “Customize” button near the top of the report page:


Now, give the custom report a name, like “Mobile/Non-Mobile Comparison”. ¬†To get the essence of this report, we will remove the “Ecommerce” metric group, and set the “Site Usage” metric group to only include “Visits” and “Pages / Visit”. ¬†The key to our report is in the “Dimension Drilldowns”. ¬†Here, change the option to “Mobile (including Tablet)”


After clicking “Save”, you can now view the report, and plot those two rows, just as before:



As far as this being even more powerful than the default mobile device report from before: note that we can set all sorts of different metrics in the custom report configuration.  This enables us to control the mobile and non-mobile data that we are comparing, and allows us to easily view the information relevant to us on a single page.