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:
- Integrate the Analytics Tracking Script into your website
- Declare Ecommerce actions to report your data
- Place test orders to validate your integration
- Become GDPR Compliant
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
<!-- Add the Tracking Script and Connect to your Account -->
<script>
(function(a,b,c,d,e,f,g){a['SkroutzAnalyticsObject']=e;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://skroutza.skroutz.gr/skroutza.min.js','skroutz_analytics');
skroutz_analytics('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>
skroutz_analytics('ecommerce', 'addOrder', {
order_id: '123456', // Order ID. Required.
revenue: '1315.25', // Grand Total. Includes Tax and Shipping. Does not include payment costs.
shipping: '5.45', // Total Shipping Cost. Does not include payment costs.
tax: '301.25', // Total Tax.
paid_by: 'example_paid_by', // Payment method type, e.g. bank_transfer.
paid_by_descr: 'Example paid_by_descr' // Payment method description, e.g. Bank transfer.
});
</script>
Note
The
paid_by
&paid_by_descr
fields are required for shops that have products in Technology categories.
Tracking Items
Use the ecommerce:addItem command to track the items of the order.
<script>
skroutz_analytics('ecommerce', 'addItem', {
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['SkroutzAnalyticsObject']=e;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://skroutza.skroutz.gr/skroutza.min.js','skroutz_analytics');
skroutz_analytics('session', 'connect', 'SA-XXXX-YYYY'); // Connect your Account.
</script>
<!-- Send the Order data -->
<script>
skroutz_analytics('ecommerce', 'addOrder', {
order_id: '123456', // Order ID. Required.
revenue: '4417.58', // Grand Total. Includes Tax and Shipping. Does not include payment costs.
shipping: '5.45', // Total Shipping Cost. Does not include payment costs.
tax: '1014.79', // Total Tax.
paid_by: 'example_paid_by', // Payment method type, e.g. bank_transfer.
paid_by_descr: 'Example paid_by_descr' // Payment method description, e.g. Bank transfer.
});
</script>
<!-- Send the Item data for each item in the shopping cart -->
<script>
skroutz_analytics('ecommerce', 'addItem', {
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.
});
skroutz_analytics('ecommerce', 'addItem', {
order_id: '123456',
product_id: '303404',
name: 'Motorola Nexus 6 (64GB) EU Light Gray',
price: '590.99',
quantity: '1'
});
skroutz_analytics('ecommerce', 'addItem', {
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.
Step 3: Place Test Orders
Place test orders using the link that is available through Merchants control panel, in order to validate that you report successfully your sales insights.
Note
You have to place a test order with every available payment method (card, paypal, pay in store, etc.).
Step 4: Become GDPR / e-Privacy Compliant
We suggest to include the necessary references about Skroutz Analytics and Skroutz CPC/CPS, in your website’s Cookie or Privacy Policy.
Detailed information can be found here or if your billing model is the Mixed Pricing Model CPC/CPS here.