Created
March 24, 2015 14:47
-
-
Save douglascayers/0094e7cb6714bc597de3 to your computer and use it in GitHub Desktop.
Google Analytics for Salesforce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hide sidebar component that embedded this javascript | |
$("h2:contains('Google Analytics')").parent().parent().hide(); | |
// Google Universal Analytics (provided by google) | |
(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'); | |
// Our analytics tracking id for salesforce production. | |
// We also enabled cross-domain linking plugins to try | |
// and handle that salesforce uses multiple sub-domains | |
// to render standard and visualforce content; we don't | |
// want the bounce arounds to be treated as separate "users" | |
// in the analytics reporting. | |
ga('create', 'UA-xxx', 'auto', { | |
'allowLinker': true | |
}); | |
ga('require', 'linkid', 'linkid.js'); | |
ga('require', 'linker'); | |
ga('linker:autoLink', [/YOURDOMAIN(\.|--)(.)*\.(salesforce|force)\.com/]); | |
ga('send', 'pageview'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Snippet for blog post https://douglascayers.wordpress.com/2014/08/17/salesforce-integrating-google-analytics/