User Tools

Site Tools


te3:incoming:standard

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
te3:incoming:standard [2014/11/26 06:28] – created moderatorte3:incoming:standard [2020/04/15 15:34] (current) – [2. JavaScript tracking] admin
Line 1: Line 1:
 +====== Incoming tracking ======
 ~~NOTOC~~ ~~NOTOC~~
-=====Standard incoming tracking ======+ 
 + 
 +To configure “incoming traffic” tracking on your site, you'll have to add a special tracking code on all pages that receive traffic (index page and all sub pages). If you are switching from a different script and have a running site, you can safely add TE3 tracking code in addition to the existing code - both scripts will track incoming traffic simultaneously. 
 + 
 +---- 
 + 
 +===== 1. Standard incoming tracking =====
  
 Standard incoming tracking is simple to setup: Standard incoming tracking is simple to setup:
  
-====PHP extension =====+==== 1.1. PHP extension ====
  
 Add the tracking code below to all your ''<nowiki>.php</nowiki>'' pages that receive traffic. Add it inside the ''<nowiki><head> </head></nowiki>'' tag. The "include" command will most likely work for everyone.  Add the tracking code below to all your ''<nowiki>.php</nowiki>'' pages that receive traffic. Add it inside the ''<nowiki><head> </head></nowiki>'' tag. The "include" command will most likely work for everyone. 
Line 10: Line 17:
 <code>include("/FULL/PATH/TO/public_html/your_te3_directory/in.php");</code> <code>include("/FULL/PATH/TO/public_html/your_te3_directory/in.php");</code>
  
-++++ Tracking code with your full path already included | We have already prepared the code with your actual full path, public html and directory - navigate to [[te3:admin_panel#Header|Main header]], select "System infofrom the {{:te3:maintenance_logo.png?nolink|}} Maintenance-drop down menu and copy-paste your code.+++++ Tracking code with your full path already included | We have already prepared the code with your actual full path, public html and directory - navigate to [[te3:admin_panel#Header|Main header]], select [[te3:system_info|System info]] from the {{:te3:maintenance_logo.png?nolink|}} Maintenance-drop down menu and copy-paste your code.
 ++++ ++++
  
 ---- ----
  
-====SSI extension =====+==== 1.2. SSI extension ====
  
 Add the tracking code below to all your ''<nowiki>.shtml</nowiki>'' pages that receive traffic. Add it inside the ''<nowiki><head> </head></nowiki>'' tag. Add the tracking code below to all your ''<nowiki>.shtml</nowiki>'' pages that receive traffic. Add it inside the ''<nowiki><head> </head></nowiki>'' tag.
Line 26: Line 33:
  
 ++++ Tracking code with your directory name already included | ++++ Tracking code with your directory name already included |
-We have already prepared the code with your actual directory name - navigate to [[te3:admin_panel#Header|Main header]], select "System infofrom the {{:te3:maintenance_logo.png?nolink|}} Maintenance-drop down menu and copy-paste your code.+We have already prepared the code with your actual directory name - navigate to [[te3:admin_panel#Header|Main header]], select [[te3:system_info|System info]] from the {{:te3:maintenance_logo.png?nolink|}} Maintenance-drop down menu and copy-paste your code.
 ++++ ++++
 +
 +----
 +
 +
 +===== 2. JavaScript tracking =====
 +
 +This method is applicable in two situations: 
 +
 +
 +++++ 2.1. If you are using caching - Wordpress users (Super Cache, Total Cache), Nginx caching, etc. | 
 +
 +
 +
 +**Configuration for Wordpress users:**
 +
 +
 +  - Install TE3 and Wordpress. \\ \\ 
 +  - Open your current theme ''header.php'' file (usually found in ''wp-content/themes/THEMENAME/header.php'' location). \\ \\ 
 +  - To set up incoming tracking place the following code after the <body> tag and rename ''domain.com'' to your actual domain name: \\ \\ <code javascript>
 +<script type="text/javascript">
 +<!--
 +function getquery(n) {
 +    var half = location.search.split(n+'=')[1];
 +    return half ? decodeURIComponent(half.split('&')[0]):null;
 +}
 +
 +function te3_js_tracking() {
 +    // parameters to be changed
 +    var domain = 'domain.com/te3/'; // domain with TE3 dir, e.g. domain.com/te3/
 +
 +    var docref = parent.document.referrer;
 +    var ref= getquery('ref');
 +    var rnd = Math.floor(Math.random() * 99999999);
 + 
 +    if(!docref) docref='none';
 +    if(!ref) ref='';
 + 
 +    docref=encodeURIComponent(docref);
 +    //document.write('<div style=\"display: none;\"><img src=\"http://'+domain+'in.php?p=default&ref='+ref+'&rnd='+rnd+'&rImg=1&refremote='+docref+'\" width=\"1\" height=\"1\" border=\"0\"></div>');
 +
 +    var img = document.createElement('img');
 +    img.setAttribute('src', 'http://'+domain+'in.php?p=default&ref='+ref+'&rnd='+rnd+'&rImg=1&refremote='+docref);
 +    img.setAttribute('width', '1');
 +    img.setAttribute('height', '1');
 +    img.setAttribute('border', '0');
 +
 +    var elem = document.createElement('div');
 +    elem.style.cssText = 'display: none;';
 +    elem.appendChild(img);
 +    document.body.appendChild(elem);
 +}
 +document.addEventListener("DOMContentLoaded", function(event) {
 +te3_js_tracking();
 +});
 +
 +// -->
 +</script>
 +</code>
 +  - Adjust "domain" variable in the ''te3_js_tracking()'' function. \\ \\
 +  - Test it to see if traffic is being counted correctly. Point your browser to a page where you have placed the tracking code and check TE3 stats to see if it was counted. 
 +
 +**Note:** \\ 
 +We have already prepared the code with your actual full path, public html and directory - navigate to [[te3:admin_panel#Header|Main header]], select [[te3:system_info|System info]] from the {{:te3:maintenance_logo.png?nolink|}} Maintenance-drop down menu and copy-paste your JavaScript incoming tracking code.
 +
 +++++
 +
 +
 +++++ 2.2. It allows you to install TE3 on sub.domain.com (separated server) and trade traffic on domain.com (primary server). |
 +
 +If you either can't or don't want to install TE3 on your primary server, remote incoming tracking might be a solution for you. This method allows you to install TE3 on ''sub.domain.com'' (separated server) and trade traffic on ''domain.com'' (primary server).
 +
 +
 +
 +**Configuration:**
 +
 +
 +  - Install TE3 on ''sub.domain.com'' on your secondary server. \\ \\
 +  - Add remote tracking code (copy paste from the frame below) to all your pages on ''domain.com'' that receive traffic. \\ \\ <code javascript>
 +<script type="text/javascript">
 +<!--
 +function getquery(n) {
 +      var half = location.search.split(n+'=')[1];
 +      return half ? decodeURIComponent(half.split('&')[0]):null;
 +}
 +
 +function te3_remote_track() {
 +    // parameters to be changed
 +    var domain = 'sub.domain.com', // te3 domain
 +        path = 'te3', // te3 path
 +        preventfrom = 'domain.com'; // prevent double track from domain.com
 +
 +
 +    var docref = parent.document.referrer,
 +        ref= getquery('ref'),
 +        rnd = Math.floor(Math.random() * 99999999);
 + 
 +    if(!docref) docref='none';
 +    if(!ref) ref='';
 + 
 +    docref=encodeURIComponent(docref);
 +//    document.write('<div style="display: none;"><img src=\"http://'+domain+'/'+path+'/in.php?p=default&rImg=1&preventfrom='+preventfrom+'&ref='+ref+'&rnd='+rnd+'&refremote='+docref+'\" width=\"0\" height=\"0\" border=\"0\"></div>');
 +
 +    var img = document.createElement('img');
 +    img.setAttribute('src', 'http://'+domain+'in.php?p=default&ref='+ref+'&rnd='+rnd+'&rImg=1&preventfrom='+preventfrom+'&refremote='+docref);
 +    img.setAttribute('width', '1');
 +    img.setAttribute('height', '1');
 +    img.setAttribute('border', '0');
 +
 +    var elem = document.createElement('div');
 +    elem.style.cssText = 'display: none;';
 +    elem.appendChild(img);
 +    document.body.appendChild(elem);
 +}
 +document.addEventListener("DOMContentLoaded", function(event) {
 +te3_remote_track();
 +});
 +// -->
 +</script>
 +</code>
 +  - Adjust "domain", "path" and "preventfrom" variables in the ''te3_remote_track()'' function. \\ \\
 +  - Test it to see if traffic is being counted correctly. Point your browser to a page where you have placed remote tracking code and check TE3 stats to see if it was counted. 
 +
 +++++
 +
 +<WRAP caution>
 +Javascript tracking method is less accurate than standard incoming tracking, therefore it should only be considered, if there is absolutely no other option.
 +</WRAP>
 +
 + 
te3/incoming/standard.1416983304.txt.gz · Last modified: 2014/11/26 06:28 by moderator

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki