Ash Bryant Posted August 25, 2009 Share Posted August 25, 2009 Hi,I'm building a shop that will have the maintenance page showing for a while, until I finish it. I have a customer template that you can see here. However if I add the Google tracking code, it crashes & returns a blank page.Any ideas how I can track the visitors to the holding page?ThanksAsh Link to comment Share on other sites More sharing options...
Ash Bryant Posted August 25, 2009 Author Share Posted August 25, 2009 Hi I have found the answer myself. Seeing as Prestashop is built with Smarty, I did a search on how to put javascript in to a smarty template. That particular issue is not addressed here, so I'm stating it below purely for the convenience of those who may try to find the answer to this problem and are using the Search feature here. So the code I'm using here is Javascript, but I guess it could be CSS or maybe PHP? [removed] var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); [removed](unescape("[removed][removed]")); [removed] [removed] try { var pageTracker = _gat._getTracker("UA-XXXXXX-X"); pageTracker._trackPageview(); } catch(err) {} [removed] because the curly braces { and } are the delimeters for Smarty tags, and thus Smarty is expecting a valid tag between them.So the solution to this is to use the {literal}{/literal} Smarty tags like this... [removed] {literal} var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); [removed](unescape("[removed][removed]")); [removed] [removed] try { var pageTracker = _gat._getTracker("UA-XXXXXX-X"); pageTracker._trackPageview(); } catch(err) {} {/literal} [removed] This will allow the Javascript in this case to be ignored. Link to comment Share on other sites More sharing options...
Recommended Posts