X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Insert Tracking Code In All Pages (https://forum.x-cart.com/showthread.php?t=70313)

nation 10-22-2014 03:50 PM

Insert Tracking Code In All Pages
 
I use Piwik for my analytics instead of Google Analytics and I would like to find a way to add the tracking code to all pages. I need to add the JavaScript Tracking Code somewhere where it adds it to all pages of the site right before the /<body> tag.

Any help would be appreciated.

tony_sologubov 10-23-2014 04:59 AM

Re: Insert Tracking Code In All Pages
 
Hi!

1) You can put your JS code into the Custom JS field of theme tweaker module (System settings > Look & feel > Custom JS in admin area).


2) if you were provided with code like <script src="http://path.to/some/script.js">, it would not work out, because this is HTML code actually and you need to apply the approach descirbed here:
http://kb.x-cart.com/display/XDD/Step+4+-+working+with+settings

3) You can also include JS code like this:
http://kb.x-cart.com/display/XDD/Adding+CSS+and+JS+files

nation 10-23-2014 05:28 AM

Re: Insert Tracking Code In All Pages
 
I copied the provided code like this that pulls from another site, added it to the custom js area under look and feel, then rebuilt cache and it did not work. Maybe this will help

<!-- Custom JS -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//tracker.com/";
_paq.push(['setTrackerUrl', u+'clienttype.php']);
_paq.push(['setSiteId', 27]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//tracker.com/clienttype.php?idsite=27" style="border:0;" alt="" /></p></noscript>
<!-- End Custom JS -->


Or a detailed explanation instead of a link, thank you

tony_sologubov 10-23-2014 05:49 AM

Re: Insert Tracking Code In All Pages
 
This is not pure JS code, because it has this <script> and <noscript> tags.
Use the solution described here: http://kb.x-cart.com/display/XDD/Step+4+-+working+with+settings and it will work out.

Tony.

nation 10-23-2014 06:06 AM

Re: Insert Tracking Code In All Pages
 
Ok, so this code is mainly for a developer, not the average person to add something to their site on all pages. I think it would be great if this was automatically added to xcart 5 so that the average person can add or remove code they need on all pages like for the header or footer...

tony_sologubov 10-24-2014 12:58 AM

Re: Insert Tracking Code In All Pages
 
I agree, it would be convenient to have such feature. Please post an idea to ideas.x-cart.com.

Anyway, I feel, that your task is quite simple and you can accomplish it without any PHP knowledge.
If you want I can guide you through the process.

Tony.

nation 10-24-2014 05:30 AM

Re: Insert Tracking Code In All Pages
 
That would be much appreciated, what do you need me to do to get started? Thank you

tony_sologubov 10-27-2014 11:21 AM

Re: Insert Tracking Code In All Pages
 
Yyou can just use the module from here:
http://kb.x-cart.com/display/XDD/Step+4+-+working+with+settings#Step4-workingwithsettings-Moduleexample

Download it, install on your X-Cart and put the tracking code to the textarea option of this module.

This is the simplest solution.

Tony.

nation 10-28-2014 06:00 AM

Re: Insert Tracking Code In All Pages
 
Ok, I have downloaded https://dl.dropboxusercontent.com/u/23858825/Tony-SettingsDemo-v5_1_0.tar

How do I install when not automatic through the marketplace?

Thanks for your help BTW...

cflsystems 10-28-2014 06:01 AM

Re: Insert Tracking Code In All Pages
 
Installed modules page - there is a button "upload module". If you are on the hosted XC5 version then you are out of luck - the only way would be to ask QT to install it for you.


All times are GMT -8. The time now is 05:22 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.