Skip to content

Commit

Permalink
Fix event tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
ruudud committed Mar 15, 2013
1 parent 6edbce5 commit 14f370f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions index.html
Expand Up @@ -109,6 +109,7 @@ <h2>Vi trenger din tilbakemelding!</h2>
</footer>

<script>
window.REINVERSION = '@@version';
function _load(u){
setTimeout(function(){
var d = document, f = d.getElementsByTagName('script')[0], s = d.createElement('script');
Expand All @@ -131,9 +132,8 @@ <h2>Vi trenger din tilbakemelding!</h2>
<script src="src/modules/list.js" type="text/javascript"></script>
<script src="src/setup.js" type="text/javascript"></script>
<!--<!(endif)-->
<!--(if target dist)><script src="reindeerfinder.min.js" type="text/javascript"></script>
<script type="text/javascript">var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-27760816-1']);_gaq.push(['_trackPageview']);var gaUrl = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; _load(gaUrl);</script>
<script type="text/javascript">(function(e,b){ if(!b.__SV){ var a,f,i,g,u;window.mixpanel=b; u=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js'; _load(u); 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.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("6e08d61adcd58df15610cb216c15f0d6");</script><!(endif)-->
<!--(if target dist)> <script type="text/javascript">var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-27760816-1']);_gaq.push(['_trackPageview']);var gaUrl = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; _load(gaUrl);</script> <script type="text/javascript">(function(e,b){ if(!b.__SV){ var a,f,i,g,u;window.mixpanel=b; u=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js'; _load(u); 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.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("6e08d61adcd58df15610cb216c15f0d6");</script>
<script src="reindeerfinder.min.js" type="text/javascript"></script><!(endif)-->

<script type="text/javascript">
if (!Modernizr.inlinesvg) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "reindeerfinder",
"version": "0.7.0",
"version": "0.7.1",
"homepage": "http://rein.ligretto.no",
"description": "Find the owner of a reindeer based on its ear markings",
"keywords": [
Expand Down
11 changes: 7 additions & 4 deletions src/setup.js
Expand Up @@ -27,11 +27,14 @@ $(document).ready(function () {
.show()
.html(REIN.templates.install());
REIN.tools.trackEvent('iphone_install start');
return false;
// FIXME the next two lines cause iPad/iPhone to freeze
//} else {
// REIN.tools.trackEvent('iphone_install complete');
return;
} else {
REIN.tools.trackEvent('iphone_install complete');
}
}
setupMainViews();

if (window.REINVERSION) {
REIN.tools.trackEvent('App Version', { label: window.REINVERSION });
}
});
11 changes: 5 additions & 6 deletions src/utils.js
Expand Up @@ -39,13 +39,12 @@ REIN.tools = {
},

trackEvent: function (event, properties) { // (category, action, opt_label, opt_value) {
window._gaq && window._gaq.push([
'_trackEvent',
properties.category || 'All',
event,
properties.label
]);
window.mixpanel && window.mixpanel.track(event, properties);
if (window._gaq) {
var category = (properties && properties.category) || 'All',
label = (properties && properties.label) || '';
window._gaq.push([ '_trackEvent', category, event, label ]);
}
},

trackPageView: function (url) {
Expand Down

0 comments on commit 14f370f

Please sign in to comment.