Search code examples
google-analyticsanalyticsutm

UTM Source not passing through (google analytics)


I've got an email campaign that Im trying to track with Google Analytics, but for some reason the source, campaign etc are not being tracked.

The URL I'm using is:

https://makemeacocktail.com/list/14911/wimbledon-cocktails/?utm_source=mailinglist&utm_campaign=weeklynewsletter&utm_term=wimbledon

I've obviously got some htaccess rules kicking in that change the php _GET variables, but that shouldn't really matter here (I dont think).

My GA tracking code is:

const dimensions = {
  TRACKING_VERSION: 'dimension1',
  CLIENT_ID: 'dimension2',
};

const TRACKING_VERSION = '1';

ga('create', 'UA-22275118-1', 'auto');
ga('set', 'transport', 'beacon');
ga('set', dimensions.TRACKING_VERSION, TRACKING_VERSION);
ga('send', 'pageview');

ga((tracker) => {
  var clientId = tracker.get('clientId');
  tracker.set(dimensions.CLIENT_ID, clientId);
});

and passing the GA script through using:

<script async src="https://www.google-analytics.com/analytics.js"></script>

(This can all be seen in the source). Am I doing something fundamentally wrong?

Thanks in advance


Solution

  • Here are a few thoughts to troubleshoot this:

    • Install the Google Analytics Debugger in Chrome and verify your pageview is triggering when the campaign URL is there. You'll be able to see individual dimensions and metrics too (so you can check you custom dimensions too).
      • It seems like you're implying that the pageviews are working, but I wanted to include this just for due diligence.
    • Looks like you're relying on ES6 and the beacon to send data. That should be fine, but if your users are on older browsers that may prevent the data from coming through.
    • UTM campaigns require a utm_campaign, utm_source, and utm_medium to be valid. This does not prevent them from sending, but I'd recommend updating your campaign URLs if possible (you're missing utm_medium).
    • Are you using a filtered view? If so, your own traffic won't appear in the reports.
    • Are you using the Real Time reports? If not, you'll need to wait a few hours before the data becomes available in the Google Analytics standard reports.

    Hopefully one of those steps gets you pointed in the right direction. Best of luck!

    Edit: Viewing the source of that link you provided, I don't see your Google Analytics snippet in there. Maybe you're working on it now, but try viewing the page in an incognito window and check the source (maybe your script is tied to an admin or dev user?).