Analytics Edit the file on GitHub

Analytics is a project to measure how users interact with partners websites.

Table of Contents

Quick Start

To successfully report your sales insights you have to:

  1. Integrate the Analytics Tracking Script into your website
  2. Declare Ecommerce actions to report your data

You can also check if there is a library already available for you ecommerce platform.

Note

To validate that the script is sending data properly, we offer a developer page with info about the reported data.

Request the link from the shop owner.

Important: That link will be accessible only during the testing phase of integration.

Step 1: Integrate the Analytics Tracking Script

Add the following snippet just before closing either the <head> or <body> section in all of your website template pages.

Use the session:connect command to initialize the tracker object for your Account.

Tracking Code JS Snippet

<script>
  (function(a,b,c,d,e,f,g){a[e]= a[e] || function(){
    (a[e].q = a[e].q || []).push(arguments);};f=b.createElement(c);f.async=true;
    f.src=d;g=b.getElementsByTagName(c)[0];g.parentNode.insertBefore(f,g);
  })(window,document,'script','https://analytics.skroutz.gr/analytics.min.js','sa');

  sa('session', 'connect', 'SA-XXXX-YYYY');  // Connect your Account.
</script>
Note

You have to replace the 'SA-XXXX-YYYY' property with the actual Shop Account ID you received from us.

For your shop to report all required data to Analytics you must declare ecommerce data.

Step 2: Declare Ecommerce Data

Send your Order and Item data with the ecommerce commands. Ecommerce commands must be added at the final step of your checkout process after a user has successfully completed a purchase. Usually this is the "Thank You" or "Receipt" page.

Note

You must first add the Tracking Code JS snippet, connect to your Account and then add the ecommerce commands.

Tracking an Order

Use the ecommerce:addOrder command to track the order.

<script>
  sa('ecommerce', 'addOrder', JSON.stringify({
    order_id: '123456',   // Order ID. Required.
    revenue:  '1315.25',  // Grand Total. Includes Tax and Shipping.
    shipping: '5.45',     // Total Shipping Cost.
    tax:      '301.25'    // Total Tax.
  }));
</script>

Tracking Items

Use the ecommerce:addItem command to track the items of the order.

<script>
  sa('ecommerce', 'addItem', JSON.stringify({
    order_id:   '123456',                                    // Order ID. Required.
    product_id: '111222',                                    // Product ID. Required.
    name:       'Apple IPhone 6 Plus (16GB) Space Gray EU',  // Product Name. Required.
    price:      '654.90',                                    // Price per Unit. Required.
    quantity:   '2'                                          // Quantity of Items. Required.
  }));
</script>

Complete Example

<!-- Add the Tracking Script and Connect to your Account -->
<script>
  (function(a,b,c,d,e,f,g){a[e]= a[e] || function(){
    (a[e].q = a[e].q || []).push(arguments);};f=b.createElement(c);f.async=true;
    f.src=d;g=b.getElementsByTagName(c)[0];g.parentNode.insertBefore(f,g);
  })(window,document,'script','https://analytics.skroutz.gr/analytics.min.js','sa');

  sa('session', 'connect', 'SA-XXXX-YYYY');  // Connect your Account.
</script>

<!-- Send the Order data -->
<script>
  sa('ecommerce', 'addOrder', JSON.stringify({
    order_id: '123456',  // Order ID. Required.
    revenue:  '4417.58', // Grand Total. Includes Tax and Shipping.
    shipping: '5.45',    // Total Shipping Cost.
    tax:      '1014.79'  // Total Tax.
  }));
</script>

<!-- Send the Item data for each item in the shopping cart -->
<script>
  sa('ecommerce', 'addItem', JSON.stringify({
    order_id:   '123456',                                    // Order ID. Required.
    product_id: '111222',                                    // Product ID. Required.
    name:       'Apple IPhone 6 Plus (16GB) Space Gray EU',  // Product Name. Required.
    price:      '654.90',                                    // Price per Unit. Required.
    quantity:   '4'                                          // Quantity of Items. Required.
  }));

  sa('ecommerce', 'addItem', JSON.stringify({
    order_id:   '123456',
    product_id: '303404',
    name:       'Motorola Nexus 6 (64GB) EU Light Gray',
    price:      '590.99',
    quantity:   '1'
  }));

  sa('ecommerce', 'addItem', JSON.stringify({
    order_id:   '123456',
    product_id: '121234',
    name:       'LG G4 (64GB) EU Leather',
    price:      '600.77',
    quantity:   '2'
  }));
</script>

Visit the examples to view complete implementation examples for different programming languages.