Analytics
5.5K members online now
5.5K 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 parameters coming from two places?

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm working on a client site to add in GA code for Facebook Instant Articles. The client is using Spredfast to publish their articles. Because of that utm_campaign, utm_source, and utm_medium are always set in the URL. We are trying to pass a fourth parameter over so that we can track views coming specifically from Instant Articles. I'm doing that now by adding this into our template.

 

<script>
        (function (i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function () {(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-   analytics.com/analytics.js','ga');
        ga('create', 'UA-xxx', 'auto');
        ga('set', 'campaignContent', 'Instant Articles');
        ga('set', 'title', '".$post->post_title."'); 
        ga('send', 'pageview');
</script>

But we're not seeing any results. I've tried different parameters other than campaignContent like dataSource, as well as campaignSource and campaignMedium before realizing these are probably being overridden by the values in the URL.

 

Today I stumbled upon this URL: https://support.google.com/analytics/answer/6205762?hl=enwhich has a flow chart that makes it sound like if there is not a Campaign Source value it will not submit any Campaign X parameters? and continues onto the utm_ section. I thought setting campaignSource in js was setting the same variable as utm_source in the URL.

 

Can we not use both utm_x in the URL and set 'campaignX' in JS?

1 Expert replyverified_user

Google Analytics parameters coming from two places?

Rising Star
# 2
Rising Star

Hi Kayla,

 

Campaign, Source and Medium are all technically required or you get gibberish. 

 

Change your primary dimension to Ad Content in your GA reports to see if you have anything there and check Page Title in your content reports.

 

I assume you are embedding your code in an iframe in the body using the figure class "op-tracker".

 

If you don't have anything, then set all the params via the GATC as you did with content.

 

Best,

 

Theo Bennett

Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Google Analytics parameters coming from two places?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
<script>
(function (i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function () {(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','__ga');
__ga('create', 'UA-189215-1', 'auto');
__ga('require', 'displayfeatures');
__ga('set', 'campaignSource', 'Facebook');
__ga('set', 'campaignMedium', 'Social Instant Article');
__ga('set', 'campaignContent', 'Instant Article');
__ga('set', 'title', 'How to rally employees after a rough customer experience'); 
__ga('send', 'pageview');
</script>

 

This is our code. I could have sworn it was working a few weeks ago. And now suddenly it's not? I saw results in Real Time view of the Title being populated correctly and the Source and Medium set to the right values. But after a few weeks, we aren't seeing results. And Real Time view is back to showing no title and wrong source/medium.


What is wrong? It looks perfectly fine.

Google Analytics parameters coming from two places?

Rising Star
# 4
Rising Star

Hi Kayla,

 

Do you have it deployed as facebook outlines here?

 

https://developers.facebook.com/docs/instant-articles/analytics

 

-Theo

Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: Google Analytics parameters coming from two places?

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Yes it is inside the proper figure and iframe tags.