Jump to content

How to integrate javascript in prestashop


Recommended Posts

Hello,

 

I'm trying to add this alexa code but every time i added it the prestashop modify it automaticly when you browse it

 

This before modification:

{literal}
<!-- Start Alexa Certify Javascript -->
<script type="text/javascript">
_atrk_opts = { atrk_acct:"**************"", domain:"**************".com",dynamic: true};
(function() { var as = document.createElement('script'); as.type = 'text/javascript'; as.async = true; as.src = "https://d31qbv1cthcecs.cloudfront.net/atrk.js"; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(as, s); })();
</script>
<noscript><img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=**************" style="display:none" height="1" width="1" alt="" /></noscript>
<!-- End Alexa Certify Javascript -->  
{/literal}
 
and this after modification:
<script type="text/javascript">/* <![CDATA[ */_atrk_opts={atrk_acct:"**************",domain:"**************.com",dynamic:true};(function(){var as=document.createElement('script');as.type='text/javascript';as.async=true;as.src="https://d31qbv1cthcecs.cloudfront.net/atrk.js";var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(as,s);})();/* ]]> */</script><noscript><img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=**************" style="display:none" height="1" width="1" alt="" /></noscript>
 
 
We need help to add it to footer without any changes..
 
Help appreciated.
  • Like 1
Link to comment
Share on other sites

it's probably because of inline js minifcation option enabled under adv.paramters > performance settings.

this option is turned on in your shop?

Can you guide me to this option because i can't find it... and is there anyway to put it as it is?

 

Sincerely,

Link to comment
Share on other sites

{literal} must be used inside <script type="text/javascript">, and it might also be necessary to wrap it within  a <![CDATA[ block :)

Hello,

 

But if it add the CDATA wrap it wont work... so what do you suggest to get this done?

Link to comment
Share on other sites

Can you guide me to this option because i can't find it... and is there anyway to put it as it is?

 

Sincerely,

1) open your back office

2) go to advanced parameters > performance section

3) check these options:

okEOYbr.png

 

 

try various combinations

Link to comment
Share on other sites

×
×
  • Create New...