Scripts To Be Added

Hi

I need to know where I can install scripts of various types:

google analytics code

chat code

no copy code

and other which I have been using on a Magento site, but am now migrating all to cs cart.

I am just not able to figure out where to add code of this type. I need to use it before head so that it will be included on all pages.

Maria

Hi,

for google analytics code use the “Google Analytics” addon from the addon section.

The oder code you can add manually into your template / templates / index.tpl in the section. For a script code don’t forget to use the “literal” tag like:


{literal}

your code…

{/literal}

You can also add custom scripts with HTML blocks (on the Default layout page) and My changes addon

http://forum.cs-cart.com/topic/37758-how-to-add-custom-javascript-with-my-changes-addon/

Also please pay attention to the following article:

https://docs.cs-cart.com/4.7.x/user_guide/look_and_feel/changing_attributes/script_display.html


The oder code you can add manually into your template / templates / index.tpl in the section. For a script code don't forget to use the "literal" tag like:

Avoid making changes to distributed code. The product has matured to the point where this is rarely necessary. You can use template hooks to do most of what you need (search Google for "cs-cart hooks").

You can also add custom scripts with HTML blocks (on the Default layout page) and My changes addon

http://forum.cs-cart.com/topic/37758-how-to-add-custom-javascript-with-my-changes-addon/

Also please pay attention to the following article:

https://docs.cs-cart.com/4.7.x/user_guide/look_and_feel/changing_attributes/script_display.html


This will probably not put the code into the 'head' section of the page.

This will probably not put the code into the 'head' section of the page.

No it won't but it probably doesn't matter. Most 3rd party scripts are more dependent on "order of execution" than they are of position in the source. I.e. as long as a script is initialized before it is referenced, it is probably irrelevant whether it's in the head or at the end of the body. You can use the scripts.post.tpl hook to get things into the head if really needed. But all scripts in the body are deferred to the end unless they have the data-no-defer attribute (like for a map, or graphic object). Note that the order of deferred scripts is maintained.

This will probably not put the code into the 'head' section of the page.

Why not? Just use another index:head_scripts hook (design/themes/THEME/templates/index.tpl)

Just because I followed the OP requirements:

I need to use it before head so that it will be included on all pages....