Permalink
Fetching contributors…
Cannot retrieve contributors at this time
101 lines (68 sloc) 3.34 KB
---
parent: analytics
title: overview
locale:
alve:
- 'en'
- 'tr'
---
<%= partial 'partials/page_locales' %>
# Analytics <%= edit_link %>
Analytics is a project to measure how users interact with partners websites.
<%= partial 'partials/toc' %>
## Quick Start
To successfully report your sales insights you have to:
1. Integrate the Analytics Tracking Script into your website
2. Declare <%= link_to 'Ecommerce', 'ecommerce' %> actions to report your data
You can also check if there is a <%= link_to 'library', '/analytics/libraries' %> 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 <%= link_to 'session:connect', 'settings/#connect' %> command to initialize the tracker object for
your Account.
#### Tracking Code JS Snippet
<%= render_code_from_file "analytics/#{flavor}/js_snippet" %>
> ##### 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** <%= link_to 'declare ecommerce data', '/analytics/', anchor: 'step-2-declare-ecommerce-data' %>.
### Step 2: Declare Ecommerce Data
Send your *Order* and *Item* data with the <%= link_to 'ecommerce', '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 <%= link_to 'ecommerce:addOrder', 'ecommerce/#addorder' %> command to track the order.
<%= render_code_from_file 'analytics/order_beacon' %>
#### Tracking Items
Use the <%= link_to 'ecommerce:addItem', 'ecommerce/#additem' %> command to track the items of the order.
<%= render_code_from_file 'analytics/item_beacon' %>
#### Complete Example
<% tracking_script = YAML.load_file(File.expand_path(File.join('./resources',
'code_examples',
"analytics/#{flavor}/js_snippet.yml"))) %>
<% complete_example = YAML.load_file(File.expand_path(File.join('./resources',
'code_examples',
"analytics/complete_example.yml"))) %>
~~~ html
<!-- Add the Tracking Script and Connect to your Account -->
<%= tracking_script[:code] -%>
<%= complete_example[:code] -%>
~~~
Visit the <%= link_to 'examples', 'examples' %> to view complete implementation examples
for different programming languages.
## Related Resources
* Configuration
* <%= link_to 'Analytics Settings', 'settings' %>
* <%= link_to 'Ecommerce metrics', 'ecommerce' %>
* <%= link_to 'Examples', 'examples' %>
* <%= link_to 'Libraries', '/analytics/libraries' %>