Jump to content

Recommended Posts

Hi, 

 

I'm new in prestashop, I'm triying to add a js code inside the ps_customtext module, i have somethin like this:

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

<a onclick="ga('send', 'event', 'pdf', 'descargar', 'FichaTecnica');" href="link_path" target="_blank">
<img src="image_source_path" alt="Descarga Catálogo" height="192" />
</a>

but when I try to save it, I have an exeption "the property CustomText->text is not valid"

 

Someone can help me.

 

Thanks

 

Share this post


Link to post
Share on other sites

you need add your google analytics code in head of your web page. You could do this by adding it in "themes\YOUR_THEME\templates\_partials\head.tpl" file so your tracking code would be available throughout your website. and for the anchor tag you could use ps_customtext module but you would need to turn off validation for tinymce editor because it won't allow onclick. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More