need4speed Posted May 28, 2011 Share Posted May 28, 2011 I have tried to insert my Google Analytics code to my prestashop.I have tried to insert the code just before the </head> tag as Google recommends but im getting a smarty error.How can I insert the code? [removed] var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-xxxxxxx-25']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s[removed].insertBefore(ga, s); })(); [removed] I know Prestashop has a Google Analytics module but its not uptodate for 1.3.6 Link to comment Share on other sites More sharing options...
jeckyl Posted May 28, 2011 Share Posted May 28, 2011 Hi,if you search in your modules page you can take a little module called Google Analytics where you can put your site id and he integrate the right code in your site. Link to comment Share on other sites More sharing options...
need4speed Posted May 28, 2011 Author Share Posted May 28, 2011 I know But it seems like the code havent been updated.If I compare the latest Google Analytic code with the one from the pshop module then its not the same. Link to comment Share on other sites More sharing options...
jeckyl Posted May 28, 2011 Share Posted May 28, 2011 Ok, but i know you can take a google analytics asynchrone on this forum. Link to comment Share on other sites More sharing options...
need4speed Posted May 28, 2011 Author Share Posted May 28, 2011 What is asynchrone ? Link to comment Share on other sites More sharing options...
jeckyl Posted May 28, 2011 Share Posted May 28, 2011 What is asynchrone ? it's the new google methode.You can take this module on http://www.prestashop.com/forums/viewthread/63094/modules_tiers/google_analytics__module_avec_tracking_asynchrone Link to comment Share on other sites More sharing options...
Digitech Posted May 31, 2011 Share Posted May 31, 2011 the reason why your page fails after inserting the javascript is because the code contains the { and the } characters. The head.tpl file is pareses by the Smarty template engine and attempts to interpret all instances of { and }. The way to resolve this is to wrap the inserted javascript code in {literal}{/literal} tags. e.g. {literal} [removed] var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s[removed].insertBefore(ga, s); })(); [removed] {/literal} Link to comment Share on other sites More sharing options...
need4speed Posted June 1, 2011 Author Share Posted June 1, 2011 Thank you Digitech I will try it later Link to comment Share on other sites More sharing options...
jeckyl Posted June 1, 2011 Share Posted June 1, 2011 I don't undertand the mfre module i give you is it right ? Link to comment Share on other sites More sharing options...
need4speed Posted June 1, 2011 Author Share Posted June 1, 2011 jeckyl im a little affraid installing it. The topic is all in France and im affraid if its ruin my live webshop. Link to comment Share on other sites More sharing options...
jeckyl Posted June 1, 2011 Share Posted June 1, 2011 jeckyl im a little affraid installing it. The topic is all in France and im affraid if its ruin my live webshop. it's just a module, adn if i give out this information it's because i'm using it on my site and it work very well. Link to comment Share on other sites More sharing options...
need4speed Posted June 15, 2011 Author Share Posted June 15, 2011 Thank you both for both solutions it helped me Link to comment Share on other sites More sharing options...
parvati Posted July 3, 2011 Share Posted July 3, 2011 Bonjour,J'ai installé ce module (sur PS 1.4.3) mais je suppose qu'il faut alors désinstaller le module google analytics prestashop d'origine ??Merci de confirmer Link to comment Share on other sites More sharing options...
bluemoon Posted July 16, 2011 Share Posted July 16, 2011 @parvati : yeap ! and it works fine for me, using the {literal} (thanks jeckyl) Link to comment Share on other sites More sharing options...
rushme Posted December 31, 2011 Share Posted December 31, 2011 it's just a module, adn if i give out this information it's because i'm using it on my site and it work very well. Hey Jeckyl... the module you linked to works fine, but it throws up an error on my one page checkout custom form.... "GA checkout form tracker is turned on, but pageTracker variable is undefined." any ideas what that is or how it can be fixed? I'm running 1.3.x Link to comment Share on other sites More sharing options...
jeckyl Posted December 31, 2011 Share Posted December 31, 2011 Hi, Hey Jeckyl... the module you linked to works fine, but it throws up an error on my one page checkout custom form.... "GA checkout form tracker is turned on, but pageTracker variable is undefined." any ideas what that is or how it can be fixed? I'm running 1.3.x This problem is link to your module OPC and not this module of google analytics. See with the developper of your module. Link to comment Share on other sites More sharing options...
rushme Posted December 31, 2011 Share Posted December 31, 2011 thanks! I just disabled the form tracker from my OPC... seems to be working... thanks for the info! Happy New year to you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now