Skip to content

Instantly share code, notes, and snippets.

@cladera
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cladera/f326172d8adab7d45fdf to your computer and use it in GitHub Desktop.
Save cladera/f326172d8adab7d45fdf to your computer and use it in GitHub Desktop.
Google Analytics Experiments in AngularJS - index.html
<html ng-app="myStoreApp">
<head>
<title>My products store</title>
<script src="//www.google-analytics.com/cx/api.js?experiment=EXPERIMENT_ID"></script>
<script>
var variant = cxApi.chooseVariation();
if(cxApi.getChosenVariation() !== cxApi.NO_CHOSEN_VARIATION){
window.variant = 'v'+variant;
}
</script>
</head>
<body>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID -->
<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-XXXXX-X', 'auto');
ga('send', 'pageview');
</script>
<div ng-view=""></div>
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="js/app.js"></script>
<script src="js/listcontroller.js"></script>
<script src="js/productcontroller.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment