Skip to content

Commit

Permalink
Track page views with Mixpanel
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Nov 27, 2014
1 parent f369879 commit f867c06
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<link rel="stylesheet" type="text/css" href="//cloud.typography.com/619254/637982/css/fonts.css">
<link href="/assets/application.css" rel="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<% if ENV['RACK_ENV'] == 'production' %>
<script>(function(f,b){if(!b.__SV){var a,e,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");
for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=f.createElement("script");a.type="text/javascript";a.async=!0;a.src="//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";e=f.getElementsByTagName("script")[0];e.parentNode.insertBefore(a,e)}})(document,window.mixpanel||[]);mixpanel.init("8de5896504a02337ca705e23a6a549b2");</script>
<% end %>
</head>
<body>
<header>
Expand All @@ -20,6 +24,7 @@
<script src="/assets/srcset.min.js"></script>
<% if ENV['RACK_ENV'] == 'production' %>
<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-39514643-2','auto');ga('send','pageview');</script>
<script>mixpanel.track('Page View',{'Title':document.title,'URL':window.location.pathname});</script>
<% end %>
</body>
</html>

0 comments on commit f867c06

Please sign in to comment.