Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (57 sloc) 3.55 KB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf8">
<title>Mixpanel plugin sample | Angulartics</title>
<link rel="stylesheet" href="//bootswatch.com/cosmo/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<script src="/node_modules/angulartics/dist/angulartics.min.js"></script>
<script src="/dist/angulartics-mixpanel.min.js"></script>
<!-- start Mixpanel --><script type="text/javascript">(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);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}})(document,window.mixpanel||[]);
mixpanel.init("82846d4a839f20a2a616b30ca30b6298", { track_pageview: false });</script><!-- end Mixpanel -->
</head>
<body ng-app="sample">
<div class="navbar navbar-default">
<div class="navbar-header">
<a class="navbar-brand" href="#/">My App</a>
</div>
<div>
<ul class="nav navbar-nav">
<li><a href="#/a">Page A</a></li>
<li><a href="#/b">Page B</a></li>
<li><a href="#/c">Page C</a></li>
</ul>
</div>
</div>
<div class="container">
<div ng-view></div>
<hr>
<button analytics-on="click" analytics-event="Button 1" analytics-category="Commands" class="btn btn-default">Button 1</button>
<!-- same as analytics-on="click", because 'click' is the default -->
<button analytics-on analytics-event="Button 2" analytics-category="Commands" class="btn btn-primary">Button 2</button>
<!-- same as analytics-event="Button 3", because is inferred from innerText -->
<button analytics-on analytics-category="Commands" class="btn btn-success">Button 3</button>
<!-- note that analytics-category is never inferred, and is required by GA... if you leave it out, no event will be tracked -->
<button analytics-on analytics-category="Commands" analytics-label="Button4 label" analytics-value="1" class="btn btn-info">Button 4</button>
<hr>
<p class="alert alert-success">
Open the network inspector in your browser, click any of the nav options or buttons above and you'll see the analytics
request being executed. Then check <a class="alert-link" href="http://mixpanel.com/report">your Mixpanel dashboard</a>.
</p>
</div>
<script>
angular.module('sample', ['angulartics', 'angulartics.mixpanel'])
.config(function ($routeProvider, $analyticsProvider) {
$routeProvider
.when('/', { template: '<h1>Root Page</h1>', controller: 'SampleCtrl' })
.when('/a', { template: '<h1>Page "A"</h1>', controller: 'SampleCtrl' })
.when('/b', { template: '<h1>Page "B"</h1>', controller: 'SampleCtrl' })
.when('/c', { template: '<h1>Page "C"</h1>', controller: 'SampleCtrl' })
.otherwise({ redirectTo: '/' });
})
.controller('SampleCtrl', function () {});
</script>
</body>
</html>