Jump to content

Statcounter javascript issue in prestashop 1.6


Recommended Posts

Hello,

 

I have a problem installing statcounter code in prestashop 1.6.

I pasted the statcounter code in footer.tpl or header.tpl. However as prestashop is reordening inline javascript to the bottom of the page, the <scripts> and <noscripts> code blocks does not seem to be in the right order anymore for statcounter to function propperly.

Is there any work around?

 

Ann

 

 

Link to comment
Share on other sites

  • 3 weeks later...

Solved !

 

You need to override Media.php :
 
create a new document Media.php
with some code that i can't post (file attached)

 

And then, save the file in override/classes
 
Next, add the code data-keepinline="true" in your script
Exemple :


<script type="text/javascript" data-keepinline="true">
// this script will remain here when rendered
alert( "hello!" );
</script>
 
<script type="text/javascript">
// this script will be forced to the bottom of the page
alert( "hello again!" );
</script>
 
I hope it will work for you !

Media.php

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...