Jump to content

Mixpanel and Prestashop integration error


Recommended Posts

Hello all,

 

Wanted to give Mixpanel (www.mixpanel.com) a go this week but ran into some issues with SmartyCompiler. The code that Mixpanel asks you to add in the <head> tags is:

 

<!-- start Mixpanel --><script type="text/javascript">(function(e,{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)))[spam-filter]var c=b;"undefined"!==
typeof d?c=b[d]=[]="mixpanel";c.people=c.people||[];c.toString=function({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[spam-filter])(document,window.mixpanel||[]);
mixpanel.init("YOURCODE");</script><!-- end Mixpanel -->

 

Adding to this to the header.tpl file of my template results in the following SmartyCompile error:

 

Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/X/header.tpl" on line 70 "<!-- start Mixpanel --><script type="text/javascript">(function(e,{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)))[spam-filter]var c=b;"undefined"!==" - Unexpected ".", expected one of: "","" , ")"'

 

Mixpanel wasn't able to help me with this - anyone know if I could re-write the JS in such a way that it would not offend SmartyCompiler ?

 

Thanks,

B

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...