Created
January 7, 2016 17:01
-
-
Save starlocke/1bdbaa9b614facb7224e to your computer and use it in GitHub Desktop.
Marketo-oriented Google Analytics Content Experiment Code
This file contains hidden or 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
<!-- Google Analytics Content Experiment code // On-Off controlled by server-side logic --> | |
<script> | |
document.ga_exp_key = ''; // Server-side logic will be responsible for this value. | |
if(document.ga_exp_key.length > 0){ | |
function utmx_section(){}function utmx(){}(function(){var | |
k=document.ga_exp_key,d=document,l=d.location,c=d.cookie; | |
if(l.search.indexOf('utm_expid='+k)>0)return; | |
function f(n){if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c. | |
indexOf(';',i);return escape(c.substring(i+n.length+1,j<0?c. | |
length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;d.write( | |
'<sc'+'ript src="'+'http'+(l.protocol=='https:'?'s://ssl': | |
'://www')+'.google-analytics.com/ga_exp.js?'+'utmxkey='+k+ | |
'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='+new Date(). | |
valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+ | |
'" type="text/javascript" charset="utf-8"><\/sc'+'ript>')})(); | |
} | |
</script> | |
<script> | |
if(document.ga_exp_key.length > 0){ | |
utmx('url','A/B'); | |
} | |
</script> | |
<!-- End of Google Analytics Content Experiment code --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment