Where Do I Place 3Rd Party Tracking Code

I need to add 3rd party javascript code between the head tags and after the title tag. I know where to do this in an html site but what about my cs-cart site?

hi,



You should make such changes via module, e.g. “My changes” so please create file:

design/themes/YOUR_THEME/templates/addons/ADDON_NAME/hooks/index/meta.post.tpl



best regards,

WSA team

If you want to put the core directly after the title, please use the meta.pre.tpl file instead of the meta.post.tpl

If the newly created directory is “index”, will this code still be effective site-wide?

[quote name='Brennie369' timestamp='1432216139' post='215251']

If the newly created directory is “index”, will this code still be effective site-wide?

[/quote]



Please clarify your question?

[quote]If the newly created directory is “index”, will this code still be effective site-wide? [/quote]



you can modify “design\themes\YOUR_THEME\templates\index.tpl” file directly (if you meant this)



NOTE: it is strongly recommended to use an add-on for this (e.g. My changes) and TPL hook (as recommended in previous posts)



best regards,

WSA team

[quote name='eComLabs' timestamp='1432222852' post='215276']

Please clarify your question?

[/quote]

If I am creating the file in a directory named “index”, will it track all pages or just the index page? (dumb question I'm sure, but I just want to make sure it tracks all pages).

it will track all pages

[quote name='Brennie369' timestamp='1432235432' post='215303']

If I am creating the file in a directory named “index”, will it track all pages or just the index page? (dumb question I'm sure, but I just want to make sure it tracks all pages).

[/quote]



Do you mean the “design/themes/YOUR_THEME/templates/views/index” directory? How do you include this file to the default CS-Cart files?

[quote name='eComLabs' timestamp='1432287089' post='215367']

Do you mean the “design/themes/YOUR_THEME/templates/views/index” directory? How do you include this file to the default CS-Cart files?

[/quote]



I am referring to this from Damir as the fix (but using meta.pre.tpl instead of meta.post.tpl per your suggestion) :

[quote name='Damir (WSA-team)' timestamp='1432190503' post='215187']

hi,



You should make such changes via module, e.g. “My changes” so please create file:

design/themes/YOUR_THEME/templates/addons/ADDON_NAME/hooks/index/meta.post.tpl



best regards,

WSA team

[/quote]

I have done the suggested My Changes edit above but no tracking data is showing in my statistics provider dashboard. In case I wasn't clear in my original post, this is a 3rd party site statistics provider, that requires placing their javascript code [color=#282828][font=arial, verdana, tahoma, sans-serif]between the head tags and after the title tag.[/font][/color]

Do you see your custom code in the page source code (Ctrl + U) ? Also please try to remove the var/cache directory manually

[quote name='eComLabs' timestamp='1432544768' post='215646']

Do you see your custom code in the page source code (Ctrl + U) ? Also please try to remove the var/cache directory manually

[/quote]



I did not see it in the source so I manually removed the var/cache directory and checked again and it is in the source now, however I did a test visit and it's still not showing data.



Just to confirm, the path of the file I made is:

[color=#000000]design[/color][color=#666600]/[/color][color=#000000]themes[/color][color=#666600]/[/color][color=#000000]YOUR_THEME[/color][color=#666600]/[/color][color=#000000]templates[/color][color=#666600]/[/color][color=#000000]addons[/color][color=#666600]/[/color][color=#ff0000]ADDON_NAME[/color][color=#666600]/[/color][color=#000000]hooks[/color][color=#666600]/[/color][color=#000000]index[/color][color=#666600]/[/color][color=#000000]meta[/color][color=#666600].[/color]pre[color=#666600].[/color][color=#000000]tpl[/color]



[color=#000000]With [/color][color=#ff0000]ADDON_NAME[/color][color=#000000] being my_changes.[/color]

The path is right. May be you should wait sometime until the tracking code is processed (like in Google Analytics)?

I gave it 24 hours and still no data. I have a ticket in with support and contacted the third party provider. Thanks for the help received here.

FYI this is how support says to add 3rd party code (which I've done but still no data):

[quote][color=#000000]To insert your own JS code we recommend you to use the following solution:[/color]



[color=#000000]Please go to [/color]Design > Layouts > Default[color=#000000] in your store admin panel. Click on the gear icon of the [/color]Home page[color=#000000] layout. Enter the necessary code into the [/color]Custom HTML code[color=#000000] input field. Activate the [/color]Copy to other locations[color=#000000] check box if it is necessary. After that save the changes.[/color][/quote]

When using the meta.pre.tpl method you should make sure you clear the site cache. Then you should be able to see it in the network tab of your browser debugger.

[quote name='tbirnseth' timestamp='1432684523' post='215897']

When using the meta.pre.tpl method you should make sure you clear the site cache. Then you should be able to see it in the network tab of your browser debugger.

[/quote]



Yes that was done. However stat data is still not showing in the third party stat tracker I'm using.

[quote name='Brennie369' timestamp='1432706972' post='215918'] Yes that was done. However stat data is still not showing in the third party stat tracker I'm using. [/quote]



What about Custom HTML code input field? Does it work now?

No still no data showing. But it is showing in the source code.