Jump to content

ps_customtext + js code


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

 

Link to comment
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. 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...