Analytics tracking on skuidified force.com site

  • 1
  • Question
  • Updated 1 year ago
  • Answered
Hello friends.

I'm trying to add analytics tracking to my skuidified force.com site, but without success.

Followed the instructions here: https://help.salesforce.com/HTViewHelpDoc?id=sites_analytics_tracking_code.htm&language=en_US

All my sites VF pages now have both  
<site:googleAnalyticsTracking/>
and
<skuid:page ...>

Google can't find my pages.

Any chance skuid doesn't play nice with the <site:googleAnalyticsTracking/> tag?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Note from Emily Maxie - our Skuid Website Guru from Marketing... 

It looks like Salesforce’s guidelines for installing Google Analytics are dated. Now, instead of worrying about properly tagging pages, you can install the Google Tag Manager tracking code on your website, and any changes you make to your analytics tags get updated without having to mess with the code. 

Here’s the link for the tag manager: https://www.google.com/analytics/tag-manager/

And here’s the link to the Google Analytics Academy course that taught me how/where to use it properly: https://analyticsacademy.withgoogle.com/course05

We placed the Google Tag Manager code in a template on the master page for the website so it would apply to all website pages. 
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Nice! Thanks.
Photo of Chandra V

Chandra V, Champion

  • 6,966 Points 5k badge 2x thumb
Anyone have the cliff notes version of this?  I have our google analytics tag manager script from our website guys.  How do I get that script to run on my master page in the template like Rob says above?  I tried sticking it in a template (allow HTML = true) but website guys aren't seeing my traffic.
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
EDITED

Not sure if this makes a difference, but have you added the GA tracking code to your force.com site page? There's a field for Analytics Tracking Code on the Site Details page, and you paste in your UA-XXXXXXX-X code there. 

With that in place, then we put this in a template on the master page:

<iframe src="//www.googletagmanager.com/ns.html?id=GTM-MDF2FH"
height="0" width="0" style="display:none;visibility:hidden"></iframe>
And the following we have added as an inline js (not snippet)
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');

with the snippet, remember to remove the stuff skuid puts into an inline snippet by default

also you might try this chrome extension, helpful for quickly addressing any issues on your page
https://get.google.com/tagassistant/
(Edited)