Last active
January 4, 2016 20:09
-
-
Save TOAST3R/8672164 to your computer and use it in GitHub Desktop.
Mixpanel example tracking
This file contains 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
//Setup | |
//To start tracking with Javascript, paste the following code into the page you want to track | |
//inside the <head> and </head> tags. Make sure to change 'YOUR_TOKEN' to the project token from your Mixpanel dashboard. | |
//We load the library onto the page asynchronously, which keeps your website loading quickly even if placed in the <head> of the page. | |
(function(c,a){window.mixpanel=a;var b,d,h,e;b=c.createElement("script"); | |
b.type="text/javascript";b.async=!0;b.src=("https:"===c.location.protocol?"https:":"http:")+ | |
'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';d=c.getElementsByTagName("script")[0]; | |
d.parentNode.insertBefore(b,d);a._i=[];a.init=function(b,c,f){function d(a,b){ | |
var c=b.split(".");2==c.length&&(a=a[c[0]],b=c[1]);a[b]=function(){a.push([b].concat( | |
Array.prototype.slice.call(arguments,0)))}}var g=a;"undefined"!==typeof f?g=a[f]=[]: | |
f="mixpanel";g.people=g.people||[];h=['disable','track','track_pageview','track_links', | |
'track_forms','register','register_once','unregister','identify','alias','name_tag','set_config', | |
'people.set','people.set_once','people.increment','people.track_charge','people.append']; | |
for(e=0;e<h.length;e++)d(g,h[e]);a._i.push([b,c,f])};a.__SV=1.2;})(document,window.mixpanel||[]); | |
mixpanel.init("YOUR_TOKEN"); | |
//Cuando se hace click en el botón: "Contratar YA" tendrían que ejecutar el siguiente código javascript: | |
mixpanel.track('External Comms Interaction', {provider: "Jazztel", position: "Contratar YA"}); | |
//Cuando se hace click en el botón: "Contratar Aqui": | |
mixpanel.track('External Comms Interaction', {provider: "Jazztel", position: "Contratar Aqui"}); | |
//Cuando se hace click en el botón: "Contratar tu cobertura": | |
mixpanel.track('External Comms Interaction', {provider: "Jazztel", position: "Comprueba tu cobertura"}); | |
// Para version responsive | |
mixpanel.track('External Comms Interaction', {provider: "Jazztel", position: "Contratar Aqui responsive"}); | |
mixpanel.track('External Comms Interaction', {provider: "Jazztel", position: "Llamada abajo responsive"}); | |
mixpanel.track('External Comms Interaction', {provider: "Jazztel", position: "Llamada arriba responsive"}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment