Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Insert Tracking Code In All Pages
 
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 10-22-2014, 03:50 PM
 
nation nation is offline
 

Newbie
  
Join Date: Sep 2004
Location: USA
Posts: 9
 

Default 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.
Reply With Quote
  #2  
Old 10-23-2014, 04:59 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is online now
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,416
 

Default 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
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #3  
Old 10-23-2014, 05:28 AM
 
nation nation is offline
 

Newbie
  
Join Date: Sep 2004
Location: USA
Posts: 9
 

Default 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
Reply With Quote
  #4  
Old 10-23-2014, 05:49 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is online now
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,416
 

Default 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.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #5  
Old 10-23-2014, 06:06 AM
 
nation nation is offline
 

Newbie
  
Join Date: Sep 2004
Location: USA
Posts: 9
 

Default 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...
Reply With Quote
  #6  
Old 10-24-2014, 12:58 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is online now
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,416
 

Default 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.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #7  
Old 10-24-2014, 05:30 AM
 
nation nation is offline
 

Newbie
  
Join Date: Sep 2004
Location: USA
Posts: 9
 

Default Re: Insert Tracking Code In All Pages

That would be much appreciated, what do you need me to do to get started? Thank you
Reply With Quote
  #8  
Old 10-27-2014, 11:21 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is online now
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,416
 

Default 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.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #9  
Old 10-28-2014, 06:00 AM
 
nation nation is offline
 

Newbie
  
Join Date: Sep 2004
Location: USA
Posts: 9
 

Default 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...
Reply With Quote
  #10  
Old 10-28-2014, 06:01 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,410
 

Default 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.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
tony_sologubov (10-30-2014)
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:27 AM.

   

 
X-Cart forums © 2001-2018