etracker
Analytics Editions / Pricing Live-Demo
etracker
Optimiser Editions / Pricing Live-Demo
Pricing For Agencies Support

Tracking Code & SDKs

Content

  1. Tracking Code Integration in Websites and Portals
  2. App Analytics tracking framework

a Tracking Code Integration in Websites and Portals

  1. Function and Purpose of the etracker Tracking Code
    1. Structure of the Tracking Code
    2. Generating Tracking Code
    3. Integrating Tracking Code (standard integration)
    4. Integrating Tracking Code (PHP, JSP, Flash, Frames, CMS)
    5. Integrating Tracking Code using Tag Manager
    6. Tracking Code integration with Security Headers
  2. Setting Parameters for etracker Analytics
    1. Basic Integration
    2. Integration of Orders and Shopping Carts
    3. Integration of External Campaigns
    4. View Tracking
    5. Cross Device Tracking
  3. Function and Purpose of the Event Tracker
    1. Structure of an Event Tracker Call
    2. Integrating Event Tracker
    3. Viewing in Report
  4. Transferring eCommerce Events
  5. Implementing On-Site Campaigns in etracker Analytics
  6. Setting Parameters for etracker Optimiser (et_popto)
  7. Measuring Dynamic Content with the Wrapper
    1. Integrating the Wrapper
    2. Wrapper Parameters
  8. My Segments
  9. Optional Parameters
  10. Data Protection Information
  11. Tips and Tricks
    1. Integrating Tracking Code into CMS and Shop Systems

1 Function and Purpose of the etracker Tracking Code

So that etracker can determine the tracking data of the website (e.g. visitors and page views), display the survey and feedback, execute testing and targeting and record the mouse movements of visitors with UX Analytics, the etracker tracking code is required. The tracking code 4.1 needs to be included once on all of the website pages to be recorded. After this, the standard integration of the tracking code is complete and, depending on the product, your etracker account will start tracking your website or you can activate the testing and targeting, UX Analytics and the survey or feedback.

Note:
For special evaluations and reports, additional data needs to be transferred via interfaces which you must integrate into the website you wish to monitor.
The following interfaces are available for this:

  • Java Script Wrapper for recording data, which should be tracked independently of a Page Impression (e.g. tracking Ajax Requests).
  • eCommerce API for recording Product Performance data, orders and transferring new order status (cancellation, lead to sales).

To use all evaluation options of the individual products completely, you can also set etracker parameters for standard integration. The code setup, the standard integration and all etracker parameters are described in the following sections.

1.1 Structure of the Tracking Code

The etracker tracking code consists of two components:

  • Parameter Block: The parameter block includes all of the adjustable control parameters. These enable, among other things, the definition of individual page names, areas and order/basket details.
Note:
All parameter values are to be transferred according to the URL encoding standard.

Setting etracker parameters is optional.

  • etracker Tracking Code: The etracker code contains the elementary number code for recording data and identifies the etracker account using the entered “Account Key 1”. Each etracker tracking code is uniquely assigned to a licensed etracker account. “Account Key 1” identifies the account whose tracking code is used at the time the data is recorded. With the code generation, the unique account key 1 is automatically inserted and may not be changed. You can find your account key under Account Info > Account Settings > Account Key.

1.2 Generating Tracking Code

To use etracker products, you will need to integrate etracker tracking code 4.1 into all of the website pages to be monitored between the opening <head> tag and the closing </head> tag. This is done as follows:

  1. Click on Account Info in the main menu. In the overlay, the submenu in which you can select the Tracking Code appears.
  2. Then follow the instructions on the screen.

In your etracker account, the etracker code for simple standard integration is provided. In addition, you can individually configure your etracker reports by setting the etracker parameters.

1.3 Integrating Tracking Code (standard integration)

The etracker tracking code is provided in the Account Info > Tracking Code menu point.

So that etracker can record your website’s data, you will need to insert the etracker tracking code into the HTML source code on each page of your website or in the template of your content management system or shop system between the opening <head> tag and the closing </head> tag.

The etracker code is set up as shown in the following example:

<!-- Copyright (c) 2000-2017 etracker GmbH. All rights reserved. --> <!-- This material may not be reproduced, displayed, modified or distributed --> <!-- without the express prior written permission of the copyright holder. --> <!-- etracker tracklet 4.1 --> <script type="text/javascript"> //var et_pagename = ""; //var et_areas = ""; //var et_url = ""; //var et_target = ""; //var et_tval = ""; //var et_tonr = ""; //var et_tsale = 0; //var et_basket = ""; //var et_cust = ""; </script> <script id="_etLoader" type="text/javascript" charset="UTF-8" data-secure-code="XXXXXX" src="//static.etracker.com/code/e.js"></script> <!-- etracker tracklet 4.1 end -->

When you use the etracker Optimiser, we recommend integrating the tracking code directly after the opening <head> tag or as close as possible to it so that the flicker effects are minimised when calling a page.

After this standard integration (without the etracker parameters), etracker will immediately start to track the website. If the URL parameters are not set for the page name, the page title will be used automatically. If the page title is not yet inserted, the URL path of the page will be used without URL parameters.

Using the etracker parameters, you can individually configure the report data and use the full range of functions of etracker.

1.4 Integrating Tracking Code (PHP, JSP, Flash, Frames, CMS)

How do I integrate the tracking code into PHP websites?

Use this PHP code:

<?php /* Sample usage: */ require_once "etracker.inc.php"; // easy base code (pagename will be detected automatically) echo etracker::getCode("YOUR_SECURECODE"); // normal base code echo etracker::getCode("YOUR_SECURECODE", array('et_pagename' => "YOUR_PAGENAME", 'et_areas' => "YOUR_AREA1/AREA2")); // base code for campaign / target pages echo etracker::getCode(  "YOUR_SECURECODE",  array(  'et_pagename' => 'YOUR_PAGENAME', // pagename  'et_areas' => 'YOUR_AREA1/AREA2', // slash delimited area names  'et_target' => 'YOUR_TARGET1,TARGET2', // comma delimited target names  'et_tval' => 5.80, // target value  'et_tsale' => 1, // target is sale (1) not a lead (0)  'et_tonr' => 'YOUR_INV_NR:123', // target order number  'et_cust' => CUSTOMER_STATUS, // status of customer  'et_basket' => 'ARTICLE1,DESCRIPTION1,GROUP1,AMOUNT1,PRICE1' // shopping cart  ),  true ); ?>

Download the file etracker.inc.php.zip here.

How do I integrate the tracking code into JSP websites?

<!-- etracker Bean instance --> <jsp:useBean id="etracker" scope="session" class="com.etracker.bean.Bean"/> <!-- easy code with default settings (pagename will be detected automatically) --> <%=etracker.getCode("YOUR_SECURECODE")%> <!-- code with some parameters set --> <%  List<CountingParameter> parameters = new ArrayList<CountingParameter>();  parameters.add(etracker.newParam(etracker.Parameter.PAGE_NAME, "my new page name"));  parameters.add(etracker.newParam(etracker.Parameter.LPAGE, 3)); %> <%=etracker.getCode("YOUR_SECURECODE", parameters)%> <!-- code with parameters set and options set  (output noscript part, not a free account, show all parameter in javascript) --> <%=etracker.getCode("YOUR_SECURECODE", parameters, true, false, true)%>

Download the file etracker-bean.jar (version 4.0) here.

How do I integrate the tracking code into Flash websites?

To integrate the etracker tracking code into Flash websites, you can find examples in the following ActionScript 2.0 and ActionScript 3.0 for triggering etracker counting from Flash.

Use the ExternalInterface.call method to call the etracker function et_eC_Wrapper from within Flash.

Examples:

ExternalInterface.call("et_eC_Wrapper", "Key", "Pagename", "Area"); ExternalInterface.call("et_eC_Wrapper", "Key", "Pagename", "Area",   "ilevel", "URL", "Target", "tval", "Ordernr",   "tsale", "Customer", "Basket";

How do I integrate the tracking code when using frames?

Usually a frameset consists of multiple small frames, e.g. with menus, copyright notices and titles as well as a large main frame in which the actual content is shown. If the visitor selects a menu point, the content of the main frame will be changed. When counting page impressions it is important to know which pages are viewed by visitors in this main frame.

To correctly count the page impressions, the etracker tracking code may only be inserted on those pages of the frameset which will be loaded later in the main frame.

How do I integrate the tracking code into content management systems and shop systems?

For content management / shop systems like, for example, Typo3 or Oxid, the etracker tracking code should be generated once manually and then inserted into the layout template.

The parameters of the etracker tracking code are then to be transferred using content management / shop system variables.

1.5 Integrating Tracking Code using Tag Manager

1 Function and Purpose of the Tag Manager

Tag managers help you to use the tracking code on different websites. They manage the tag configuration and control when the tags are triggered.

2 Setting up Google Tag Manager with etracker

Proceed as follows:

1. Register yourself with the Google Tag Manager using the email and password of your Google account: https://www.google.com/intl/de/tagmanager/
2. Set up an account for a company and select Next.

google-tag-manager

Set up a container for the company website. The container records the tags for controlling the tracking code.

Then click on “Create account and container”.

google-tag-manager_2

3. Accept the Terms & Conditions of the Google Tag Manager. The next window shows a generated container snippet.
4. Integrate the container snippet shown in the window as displayed into every page of your website.
5. Build a data layer into your website which contains the etracker parameter values in JavaScript variables. Instructions and an explanation for this can be found, among other things, at: https://developers.google.com/tag-manager/devguide
6. Click on “Add new tag”.

google-tag-manager_3

Then click on “Tag Configuration”.

google-tag-manager_4

And then click on “User-defined HTML tag” in order to add a tag with your etracker tracking code to your container.

google-tag-manager_5

Tick the check box beside support “document.write”. To be able to generate the tag, it is now necessary to select a trigger. Cconfirm it by pressing “Save”.

google-tag-manager_6

Add a trigger rule for “All pages”. Copy the tracking code from the etracker application under Settings > Setup/Tracking code, add it to the HTML window and customise it to your website by assigning the variables from your data layer to the JavaScript variables of the tracking code (see Tracking Code Integration in Websites and Portals). Finally click on “Save”.

7. Remove the old tracking code from your website and click on “Publish” in order to provide the website with the container with the tag.

Note:
Please note that no data is recorded between removing the tracking code from the website and publishing the container.

1.6 Tracking Code integration with Security Headers

To integrate the tracking code with an enabled Content Security Policy or X-Frame Options, please ensure that the necessary header settings are applied.

2 Setting Parameters for etracker Analytics

To be able to use the reports in etracker Analytics as optimally as possible, you should perform basic integration at the very least. You can only use the reports with the sales figures for orders and baskets if you set further parameters (provided these reports are activated for you).

If you should already be using the product etracker Web Analytics with the marketing functions (campaigns, website targets, basket, etc.), you can continue to use the corresponding etracker parameters as normal. Orders and sales will then be added automatically from the tracking code variables for Web Analytics to etracker Analytics.

var et_pagename  =  ""; // Pagename var et_areas     =  ""; // Area

2.1 Basic Integration

Defining the page names and the areas are part of the basic integration. Basic integration guarantees the usability of all Web Analytics Reports except for the Marketing of eCommerce Reports.

Use the following parameters for the basic integration:

2.1.1 Pagenames [et_pagename]

Inside the etracker application, all pages of a website will have their own page name. The pagename is recorded for each page of your website using the et_pagename parameter and should follow the following guidelines:

  • Uniqueness: Each page must be assigned its own unique page name.
  • Legibility: For easy and convenient evaluation, every page name should be easily legible and short.

Transfer a page name as follows:

var et_pagename  =  "PAGENAME"; // Pagename //string URL-encodeter Pagename; //Free text max. 255 characters //Default ""

If you remove the parameter et_pagename from the parameter block or if you do not set it, the page title will be used automatically. If the page title is not yet inserted, the URL path of the page will be used without URL parameters.

If you leave the et_pagename parameter empty (et_pagename = “”), the page will be saved under the page name “Index page”.

Note:
If you assign the same page name to different pages of the website, these pages will be compiled under one page name and it will not be possible to view them separately.

2.1.2 Areas [et_areas]

Along with the page designation, you can transfer the optional parameter of the areas to etracker. This parameter opens up additional options when performing analyses.

Transfer an area name as follows:

var et_areas    = "Privatcustomer"; //string:  URL-encodete(r) Area name(n); //Free text max. 255 characters; //Default: ""

You can assign a single page of the website to a specific area.

Area names can be set up hierarchically. To do so, separate the individual hierarchy levels using a forward slash “/”.

Example: A website is divided into the areas “Menswear” and “Womenswear” fashion, each of which has their own different product sections and subsections. The etracker area names could then be called something like this:

“Menswear/Clothing/Shirts”
“Menswear/Clothing/Trousers/Chino”
“Menswear/Shoes”
“Womenswear/Clothing/Dresses”
“Womenswear/Clothing/Trousers/Chino”
“Womenswear/Shoes”

The areas are to be transferred URL-encoded like the page designation.

2.2 Integration of Orders and Shopping Carts

There are two different options for transferring orders and baskets to etracker. One is to use the parameters available from the tracking code and the other is the eCommerce interface.

For simple counting of the orders and baskets, you can use the parameters. To perform detailed analyses, like differentiating between Product seen, Product placed in basket, Product removed from basket, Product ordered and possibly Quantity of cancelled products, you will need to use the eCommerce interface. You can find more information about this at Transferring eCommerce Events..

With orders you can differentiate between lead and sale volumes. The leads, sales and cancellations will only be shown in special reports like the product performance or order reports.

The following parameters can be used to define orders and baskets in the tracking code:

var et_target = ""; //Conversion target var et_tval = "0"; //Conversion value var et_tonr = ""; //Order number var et_tsale = 0; //Conversion status var et_basket = ""; //Shopping basket

To define an order, you need to set the parameters et_target, et_tval, et_tonr and et_tsale. These four parameters are also prerequisites for using other parameters. As such, you require these four parameters in order to, for example, transfer basket information.

2.2.1 Sale Targets [et_target]

The name for a turnover target is defined using the et_target parameter. You may only set this parameter on pages on which you would like to transfer a sale. Otherwise, this parameter cannot be filled in (et_target = “”) or exist.

Transfer a website target name as follows:

var et_target   = "My%20target"; //string:     URL-encoded Target name  //Free text max. 255 characters //No comas or semicolons allowed //Default ""

 2.2.2 Sale [et_tval]

Transfer the sale to etracker with the help of the et_tval parameter. Please set the et_tval parameter only on the order confirmation page so that inconsistencies do not come about and only the actual order is listed in the report.

Since no units are transferred with the sale, you should transfer the sale net and in a set currency. This way comparisons are also possible when changing the value added tax rate.

You can transfer the sale as follows:

var et_tval = "39.95"; //float: net turnover made upon the target being reached. //Decimal points are shown as dots. //A maximum of two places after the decimal point is suppoted. //Units are not supoorted. //Default "0"
Note:
To define a sales target, you also need to fill in the et_target, et_tonr and et_tsale parameters.

2.2.3 Order number [et_tonr]

The order number (or the process number) serves to clearly identify the volume. This is used for both the manual and automatic confirmation of leads to sales. If there is no invoice number, a timestamp, for example, could also function as a clear identifier.

Please set the et_tour parameter only on the order confirmation page so that inconsistencies do not come about and only the actual order is listed in the report.

You can transfer the order number of a sale as follows:

var et_tonr     = "RG_1234"; //string:    Unique order number.  //Free text max. 50 characters. //No commas or semicolons permitted. //Default ""
Note:
To define a sale target, you also need to fill in the et_target, et_tval and et_tsale parameters.

2.2.4 Order status [et_tsale]

The parameter et_tsale indicates if the order is a lead order or a sale order.

You can transfer the order status as follows:

var et_tsale = 0; // integer:    0 = Lead  //                 1 = Sale //                    2 = Storno // Default 0
Note:
If business operations do not generate any lead orders, then all orders should be transferred as sale orders.
When creating leads and sales, you need to fill in the parameters for creating a sales target (et_target, et_tval, et_tonr and et_tsale).
The leads, sales and cancellations will only be shown in special reports like the product performance or order reports.

2.2.5 Basket [et_basket]

To communicate the basket information, you will also need to use the et_basket parameter in addition to the sales target parameters. Please note that the et_basket parameter should only be filled out on the order confirmation page so that inconsistencies do not come about and that only actually purchased items are listed in the report.

The information in the basket will be transferred as follows:

var et_basket = "ArtNr,ArtName,ArtGroup,Number,Price"; //string: Shop system parameters to define shopping basket article //Default "";

A data record consists of the following elements:

  • ArtNr: Unique article code of the order product, max. 50 characters.
  • ArtName: Designation of the corresponding item, max. 100 characters.
  • ArtGroup: Designation for the respective product category, max. 50 characters.
  • Number: Order quantity of the article.
  • Price: Item price of the article. Decimal points are shown as dots. Units (Euro (€), Dollar ($) etc.) are not shown.

The individual elements inside a data record are separated by a comma. If the visitor to the website should order multiple articles, they are separated by a semicolon.

The basket for multiple items is transferred as follows:

var et_basket = "ArtNr,ArtName,ArtGroup,Number,Price"; //string: Shop system parameters to define shopping basket article
//Default "";
Note:
Should special characters be contained in these elements, they will need to be encoded beforehand according to the URL encoding standard. Commas and semicolons are not allowed within the elements.
When using et_basket, you will also need to fill out the parameters for creating a volume target (et_target, et_tval, et_tonr and et_tsale).

2.2.6 Visitor type – Existing customer / New customer [et_cust]

The parameter et_cust indicates if it was an existing customer or a new one who placed the order. Specifying whether they are existing customers or new customers is the job of your website or content management / shop system. The visitor status must then be transferred to etracker.

The visitor status (existing customer / new customer) is transferred as follows:

var et_cust     = 0; // integer:      0 = Existing customer //               1 = New customer // Default 0

2.3 Integration of External Campaigns

To track external campaigns like banners or links in newsletters using etracker Analytics, you need to make etracker aware of your campaign structure. This is done by creating or changing campaign links or by adding parameters. This lets you analyse your campaigns in pre-defined or individual reports. The campaigns will be visible in etracker Analytics as soon as there has been at least one click on a campaign link with parameters.

2.3.1 Attributes and Key Figures for External Campaigns

Using additional URL parameters, you can transfer information on promotional material links to etracker. This information is saved in campaign attributes. Each campaign attribute refers to a property of the campaign or organic contacts of external websites like, for example, the medium, “SEA” or campaign “Summer2012”. Some attributes can be determined implicitly from the origin data communicated by the browser. This way, for example, you can determine the entry page from the URL or the origin domain from the referrer.

Every external contact (e.g. click on a campaign link) generates a series of attributes in the reports. The attributes are connected using predefined key figures and results (e.g. number of clicks, page impressions or visits) and thereby permit the evaluation and appraisal of the website traffic. The more parameters you integrate into your advertising, the greater detail you will have when performing analyses using individual reports.

For integrating into campaign links, etracker provides you with the following attributes:

AttributeParameter (attribute name)DescriptionAttribute values (examples of a holiday home provider)
Medium
(mandatory parameter)
etcc_medType/Channel of a contact“SEO”, “SEA”, “Social Media”, “Email”, “Display”, “Affiliate”
Campaign
(mandatory parameter)
etcc_cmpDifferentiation between different campaign actions in order to compare different campaigns.“Zanox”, “Summer2012” (“organic”, if parameters not present)
Originetcc_oriOrigin domain provided there is a referrer (name of the search machine or URL of the website on which the advertising was place).“Google”, “www.facebook.com”
Groupetcc_grpSubgrouping for campaigns, e.g. AdGroup in Google AdWords® or a newsletter group.“Croatia” and “Greece” as subgroups for the “Summer2012” campaign.
Advertetcc_ctvName of the advert“HH_Istria”
Variantetcc_varVersion of the advert (variant) on which a visitor clicked. Used for content-relevant advertising and content tests (A/B test) to determine which version of an advert attracts sales-increasing new customers in the most effective way.“A” and “B” as newsletter variants which are sent via email,
“150x120” as advert variant in the display advertising.
Objectiveetcc_tarTarget of a campaign“Sales”, “Branding”, “Leads”, “Registration”
Placementetcc_plcArea of a website in which advertising is activated.“top right” or “2” (as previously set numerical position)
Partnersetcc_parAdvertising partner or network“Google”, “Zanox”, “Affilinet”, “Facebook”
Keywordetcc_keyEntered search word or phrase in search engine marketing. “Holiday home Istria”
Booked keywordetcc_bkyKeyword which is booked in search engine marketing“holiday+home+istria”
Matchtypeetcc_mtySearch type for a booked keyword in search engine marketing“standard” or “std”
Advertiseretcc_advDifferentiation of the advertiser (primarily for the agencies to make it possible to differentiate between multiple clients).
Booked deviceetcc_bdeDevice booked in Google AdWords. Can be used to limit the campaign numbers according to device types like desktop PC, tablet PC and mobile phone.
Agencyetcc_acyAdvertising agency or a performance agency which places the advertising. For companies working with multiple agencies.“Advertising agency X”
Domainetcc_domDomain of the visited website
Note:
Medium and campaign are mandatory attributes which you have to use in your campaign links. You can use the other parameters optionally. What’s important is that you use them uniformly throughout your individual campaign structure. Along with the predefined attributes, you can also define your own ones.

To create campaign links with etracker, etracker will provide you with an assistant. The assistant can be found in Basic Reports > Campaigns > Help.

03-menu-states_klein

Further details together with step-by-step instructions can be found under Web Analytics Operation.

2.3.2 Integrating Campaign Link into Advertising

A campaign link is a link which is placed into an advert on any website and refers to the homepage of the advertising company. It includes the parameters of the attributes and the relevant attribute values.

Clicking on the campaign link

http://www.YourWebsite.com?etcc_cmp=Remarketing&etcc_med=Mailing&etcc_ctv=ProductA&etcc_var=Focus Sales

generates, for example, the following in the table:

firefox_screenshot_2016-09-07t12-46-45-604z

To assist with creating a campaign link, you can use the campaign link generator which can be found under “etracker analytics” 02 Marketing Reports > Campaign Help.

2.3.3 Supplementing or Overwriting Campaign Parameters

If you wish to supplement or overwrite the parameters in a URL, you can use the cc_attributes parameter and thereby transfer the campaign attributes to etracker.

Set the cc_attributes parameter inside the parameter block at the start of the tracking code.

Supplementation of the URL with additional attributes and their values:

Syntax:

cc_attributes["Attribute name"] = ["Attribute value",false];

Möglich ist auch:

cc_attributes["Attribute name"] = "Attribute value";

If the attribute name already exists in the original URL, the corresponding attribute value remains in the evaluable URL. If the attribute name is not in the original URL, then the attribute name will be added there with its value.

Example:

The campaign URL should be supplemented with your own “act” (action) attribute on the page.

Original URL:

http://www.YourSite.de?etcc_cmp=Campaign&etcc_med=Display&ver=no

Your attribute: act=Sale

The cc_attributes parameter is to be set as follows:

cc_attributes["akt"] = ["Sale", false];

For processing, the attribute “act” has been added to the evaluable URL:

http://www.YourSite.de?etcc_cmp=Campaign&etcc_med=Display&akt=Sale&ver=no

Overwriting the Attribute Values in the URL:

If you wish to supplement the original URL not just with additional attributes, but with the values of existing attributes, set true instead of false:

cc_attributes["Attribute name"] = ["Attribute value",true];

If the attribute name already exists in the original URL, the corresponding attribute value will be overwritten there. If the attribute name is not in the original URL, then the attribute name will be added there with its value.

Example:

The campaign URL should be supplemented with the attributes “prd” (product) and “etcc_var” (variant). If these attributes already exist in the original URL, their values should be overwritten.

Original URL:

http://www.YourSite.de?etcc_cmp=Campaign&etcc_med=Display&prd=ProductA

Your attributes: prd=ProductB, etcc_var=123

The cc_attributes parameter is to be set as follows:

cc_attributes["prd"] = ["ProductB", true]; cc_attributes["etcc_var"] = ["123", true];

So for processing, the attribute “etcc_var” has been added to the evaluable URL and the “prd” value overwritten:

http://www.YourSite.de?etcc_cmp=Campaign&etcc_med=Display&prd=ProductB&etcc_var=123

2.4 View-Tracking

In etracker Analytics you have the option to record views of, for example, Display Ads and view them together with other campaign contacts (clicks) in one report. A corresponding measure of the success of varying campaign types is made possible with the help of a different conversion period depending on the campaign contact. Similarly, tracking how many times a newsletter email is viewed is also possible.

The number of views generated in the observed period is shown in the individual report under the key figure “Views”.

  • In the individual report, you have the option to select the key figure “Views” (etcc_imp) and save your own configuration.
  • Recording a view is done with the help of the redirect and the parameter etcc_imp.
  • The period of the conversion allocation (cookie period) is entered in hours and transferred as a value with the etcc_imp parameter.
  • If you use the redirect to record views, it is not necessary to use the etcc_url parameter.
  • Like with the “Click” redirect, the medium (etcc_med) and the campaign (etcc_cmp) need to be set and filled as a minimum.
  • Integration is executed using a script element.

Example integration:

<script src="https://www.etracker.de/ccr?et={SECURE CODE} &etcc_cmp=view_campaign&etcc_med=STC_CC_ATTR_VALUE_OTHER&etcc_imp=48">
  • The conversion period in this example is 48 hours.
  • For the conversion period, you can use the parameter ‘etcc_imp’ to enter values between 1 and 4320 (max. 180 days).

Example: Tracking views of the display campaigns run by affiliate partners

You run display advertising via affiliate partners and would like to know how often the display was viewed. In addition you want to track conversion in etracker when a visitor purchases the advertised product from your online shop within four days of seeing the banner.

  1. Generate the redirect link (e.g. via the campaign link tool in the etracker application [Marketing Reports -> Campaign -> Help])
    Example redirect link:

    https://www.etracker.de/ccr?et={SECURE CODE} &etcc_cmp=Summer_offer&etcc_med=affiliate&etcc_par=partnerxy
    Note:
    If you generate the link in the campaign link tool in the application, the {SECURE CODE} suitable for the account will already be issued in the link.
  2. So that the call can be tracked as a view, supplement the link with the parameter ‘etcc_imp’ and the value 96 (4 days = 96 hours).
    https://www.etracker.de/ccr?et={SECURE CODE}  &etcc_cmp=Summer_offer&etcc_med=affiliate&etcc_par=partnerxy&etcc_imp=96
  • Now enter this link into the script element.
    <script src="https://www.etracker.de/ccr?et={SECURE CODE}  &etcc_cmp=Summer_offer&etcc_med=affiliate&etcc_par=partnerxy&etcc_imp=96">

This code can then be transferred to your affiliate partner for integration into the display advertising.

2.5 Cross Device Tracking

Cross device tracking enables the analysis of visitors to your website on any device. The unique identification of a visitor can, for example, be done via a newsletter or login. With the help of the etracker parameter et_cdi, a value (identifier) is transferred which is used to identify the website visitor.

  • The identifier is always saved in hashed format by etracker, and independently of this, the identifier should have already been transferred in hashed format for reasons of data privacy.
  • The identifier must be unique for each website visitor, otherwise different user profiles will be merged together.
  • The et_cdi parameter can be set in the etracker parameter block or transferred with the wrapper.
  • The identifier needs to be transferred with each page call.
Note:
Cross device tracking needs to be activated for each etracker account by our technology. Here, please contact our support under +49 (0)40 55 56 59 77 or support@etracker.com

3 Function and Purpose of the Event Tracker

With the help of the event tracker, you can assess the interactions of website visitors, thereby allowing you to retrieve comprehensive key figures on the use of your interactive website contents. These events cannot be tracked using a conventional tracking code. In addition to the etracker tracking code, you need a JavaScript function which dynamically triggers the counting of the interactions.

This so-called event tracker function is necessary for tracking clicks on links.

To record the data, build the corresponding JavaScript code for dynamically triggering the counting into the website to be monitored at a suitable position. This is useful for example for downloads, video playback or when clicking on pictures.

Note:
All values are to be communicated in the URL-coded format (RFC 3986) as per the ISO standard, particularly when they include special characters.

The event tracker function triggers payment dynamically according to the tracking code implemented on the page.

3.1 Structure of an Event Tracker Call

The following function in the etracker JavaScript sends the corresponding events:

_etracker.sendEvent(Event-Object)

This universal function accepts every defined event object. The differentiation of the different events is thereby defined by the event objects. In the simplest case, these are generated directly in the function. It should however be generated with a “new”.

To transfer additional information on an event to etracker, use the ‘Type’ event attribute. This way, it is possible to distinguish between the events in a more comprehensive way. In the event report under ‘Segmentation’ > ‘Segments’‚ > ‘Add’ > ‘Content’ > ‘Type’, the event attribute can be selected.

JavaScript function with a click event:

_etracker.sendEvent(new et_ClickEvent(‘ExternalLink1’,'Banner1'));

3.2 Integrating Event Tracker

The event tracker is delivered with the default JavaScript code of etracker and can be integrated as follows:

Example PDF call:

<a href="http://www.YourSite.de/test.pdf" onmousedown="_etracker.sendEvent(new et_DownloadEvent(‘My%20PDF’,'Manual'))">PDF-Download</a>

Example Button for starting a film:

<input type="button" value="Film start" onmousedown="_etracker.sendEvent(new et_VideoStartEvent(‘Film1’,'ProductPreview'))">

Transfer using the event tracker functions looks like this:

JavaScript function Description
et_DownloadEvent(eventObject,eventType) Tracks downloads of documents.
et_ClickEvent(eventObject,eventType) Tracks clicks on any element.
et_LinkEvent(eventObject,eventType) Tracks clicks on internal and external links.
et_AuthenticationSuccessEvent(eventObject,eventType) Tracks a successful login.
et_AuthenticationFailureEvent(eventObject,eventType) Tracks an unsuccessful login.
et_AuthenticationLogoutEvent(eventObject,eventType) Tracks a successful logout.
et_AudioStartEvent(eventObject,eventType) Tracks the start function of a music player.
et_AudioStopEvent(eventObject,eventType) Tracks the stop function of a music player.
et_AudioPauseEvent(eventObject,eventType) Tracks the pause function of a music player.
et_AudioMuteEvent(eventObject,eventType) Tracks the mute function of a music player.
et_AudioSeekEvent(eventObject,eventType) Tracks the playback function of a music player.
et_AudioNextEvent(eventObject,eventType) Tracks the Next function of the music player.
et_AudioPreviousEvent(eventObject,eventType) Tracks the Back function of a music player.
et_VideoStartEvent(eventObject,eventType) Tracks the start function of a video player.
et_VideoStopEvent(eventObject,eventType) Tracks the stop function of a video player.
et_VideoPauseEvent(eventObject,eventType) Tracks the pause function of a video player.
et_VideoMuteEvent(eventObject,eventType) Tracks the mute function of a video player.
et_VideoSeekEvent(eventObject,eventType) Tracks the playback function of a video player.
et_VideoNextEvent(eventObject,eventType) Tracks the Next function of the video player.
et_VideoPreviousEvent(eventObject,eventType) Tracks the Back function of the video player.
et_VideoFullsizeEvent(eventObject,eventType) Tracks the fullscreen function of a video player.
et_VideoRestoreEvent(eventObject,eventType) Tracks the normal screen function of a video player.
et_GalleryViewEvent(eventObject,eventType) Tracks the view of a picture.
et_GalleryZoomEvent(eventObject,eventType)Tracks the zoom function of a picture.
et_GalleryNextEvent(eventObject,eventType)Tracks the next function of a picture gallery.
et_GalleryPreviousEvent(eventObject,eventType)Tracks the back function of a picture gallery.

3.3 Viewing in Report

The values transferred with the event tracker are displayed as follows in the event report:

View in the ‘Events’ report

4 Transferring eCommerce Events

  1. Functionality of the eCommerce API
  2. Access to the eCommerce API
  3. Debug Modes
    1. Switching on Debug Mode with Configuration Object _etr
    2. Switching on Debug Mode with Variable etCommerce.debugMode
  4. The Functions of the eCommerce API
    1. sendEvent – Sending Event directly
    2. attachEvent – Connecting Event to Object
  5. Possible Events
    1. viewProduct – Product seen
    2. insertToWatchlist – Product added to the watchlist
    3. removeFromWatchlist – Product removed from watchlist
    4. insertToBasket – Product placed into basket
    5. removeFromBasket – Product removed from basket
    6. order – Order
    7. orderConfirmation – Order transferred from Status Lead to Status Sale
    8. orderCancellation – Order cancelled
    9. orderPartialCancellation – Order partially cancelled
  6. Event Objects
    1. The Product Object
    2. The Basket Object
    3. The Order Object
  7. Examples of Use
    1. Product page viewed
    2. Product placed into basket
    3. Removing a product from the basket
    4. Sending an order with a click
  8. Change log
    1. Version 1.1.1
    2. Version 1.1.3

1 Functionality of the eCommerce API

The eCommerce API is a JavaScript interface. It can receive and transfer different events to etracker which a customer triggered in an online shop. This can be done on each page call or in a way that is controlled by the event. The transferred data consists of information about the products, baskets and orders. Using the data collected this way, you can, for example, determine how many baskets were abandoned or which products were viewed particularly often.

The data transfer can be done at the actual point in time of the action by the customer, when, for example, the customer places the product into the basket, or later on when, for example, a form is sent. Here, the event is only sent when the customer has arrived at the following page. In an asynchronous environment, it is also possible to save events and only send them to etracker when the tracking code has loaded. The examples lower down explain the different ways to integrate events.

2 Access to the eCommerce API

Before you can use etracker Analytics, the eCommerce API and all other etracker products, you need to integrate the current etracker tracking code, which you can find in your etracker account at Settings > Setup/Tracking Code, into all of the pages of your website which you wish to track. In addition, we recommend setting the et_pagename parameter so that the reports can show the individual pages of your website.

The interface is activated upon provision of the etracker tracking code so that the events can be integrated immediately into the code.

3 Debug Mode

The interface is equipped with a debug mode which is particularly helpful when integrating the eCommerce API. When debug mode is activated, error messages, events and the call of the etracker interface are shown in the JavaScript console. The events will not be transferred to etracker when debug mode is activated.

The mode can only be switched on once the tracking code has been fully loaded.

To be able to read the output, developer tools, which are offered by multiple browsers nowadays, can help.

BrowserDeveloper toolWhere to find?
FirefoxFirebughttps://addons.mozilla.org/de/firefox/addon/firebug
Internet Explorer EntwicklertoolsIs integrated in the browser
ChromeEntwicklertoolsIs integrated in the browser
OperaDragonflyIs integrated in the browser
SafariFirebug litehttp://getfirebug.com/firebuglite

3.1 Switching on Debug Mode with Configuration Object _etr

Note:
The configuration object can only be integrated when you use the current tracking code 4.x. The setting only executes when the file e.js has reloaded. Events sent prior to this will be checked for errors as they are only processed once e.js has loaded.
_etr should not be overwritten if it already exists.

Example:

<script type="text/javascript" charset="UTF-8">  // Parameterblock  var et_pagename = "__INDEX__";  _etr = {  debugMode = true;  } </script> <script id="_etLoader" type="text/javascript" charset="UTF-8" data-preload-dc="data-preload-dc" data-secure-code="Account Key 1" src="//static.etracker.com/code/e.js"></script>

3.2 Switching on Debug Mode with Variable etCommerce.debugMode

Note:
The variable etCommerce.debugMode must be set after calling the tracking code. Tracking Code 4.x is called by the file e.js.
// activation of debug mode etCommerce.debugMode = true ;

Example of tracking code 4.x etCommerce.debugMode after parameter block and etracker code:

<script type="text/javascript" charset="UTF-8">   // Parameterblock   var et_pagename = "Pagenname";  </script>  <script id="_etLoader" type="text/javascript" charset="UTF-8" data-preload-dc="data-preload-dc" data-secure-code="Account Key 1" src="//static.etracker.com/code/e.js"></script>  <script type="text/javascript" charset="UTF-8">   var etCommerce.debugMode = true ;  </script> 

4 The Functions of the eCommerce API

The interface has two basic functions for transferring information to etracker: sendEvent and attachEvent. sendEvent is the direct call of an eCommerce event defined by the interface, which sends the transferred values immediately. If sending should be coupled to a specific JavaScript event, e.g. visitor clicks on ‘into the basket’, then the function attachEvent, which attaches the eCommerce event to a desired object on the website, can be used.

If the tracking code is integrated at the end of the HTML page or loads asynchronously, then it is possible to save events and the attachment of events to HTML objects to the temporary buffer. The functions are then executed when the etracker tracking code has loaded fully.

4.1 sendEvent – Sending Event directly

etCommerce.sendEvent(event, parameter_1, [parameter_n])

The function sendEvent of the object etCommerce is then called directly in JavaScript. The transferred values are transferred directly to etracker.

Function parametersData typeLimitationDescription
eventstringOnly those events defined by the interface are supported (see section 5).unterstützt (siehe Kapitel 5).Name des Events
parameter_1, [parameter_n] varyingSee further description
Note:
Parameters in square brackets [ ] are optional parameters.

Beispiel:

// direct call etCommerce.sendEvent('viewProduct', product, 'basket 1') ;

4.2 attachEvent – Connecting Event to Object

etCommerce.attachEvent(attachObject, event, parameter_1, [parameter_n])

With the attachEvent function you can attach an eCommerce Event to every website object which has an ID. This is then triggered by the specified JavaScript event. This way, clicking on the Into the basket button transfers the eCommerce event to etracker.

Function parametersData typeLimitationDescription
attachObjectObjectOnly existing JavaScript events and object IDs, which are determined by getElementById, are supported.
The object structure is as follows: {'Eventname' : ['Object-ID1', ‘Object-ID2’]}
The JavaScript event and the IDs of the website objects to which this event is attached are contained in this object.
eventstringOnly those events defined by the interface are supported (see section 5).Name of the attached event
parameter_1, [parameter_n]varyingSee further description
Note:
Parameters in square brackets [ ] are optional parameters.

Beispiel:

// Direct link of an eCommerce Event with a JavaScript-Event  etCommerce.attachEvent({'mousedown' : ['viewButton']}, 'viewProduct', product, 'basket 1') ;

5 Possible Events

Currently the eCommerce API supports eight different events which are described in the following section.

5.1 viewProduct – Product viewed

This event can be sent when the customer is on the product page or on a product overview page.

Function parametersData typeLimitationDescription
'viewProduct'stringOnly this name is approvedName of the event
Product objectobjectThe object must correspond to the product object description (see Section 6.1)A product object

Examples:

// Definition of a product objekt var product var product =  {  id : '3445',   name : 'Elfrida',   category : ['Animals', 'Big', 'Giraffes', 'Love Giraffes'],   price : '1723.60',   currency : 'EUR',   variants : {'color' : 'yellow', 'gender' : 'female', 'Figur' : 'thin'} };
// Direct call etCommerce.sendEvent('viewProduct', product, 'basket 1') ;
// Attached as event etCommerce.attachEvent({'mousedown' : ['button_ view']}, 'viewProduct', product, 'Warenkorb 1') ;

5.2 insertToWatchlist – Product added to the watchlist

This event is sent when the customer adds a product to their watchlist.

Function parametersData typeLimitationDescription
'insertToWatchlist'stringOnly this name is approvedName of the event
Product objectobjectThe object must correspond to the product object description
(see Section 6.1)
A product object
Numberinteger0 - 65 535
Negative numbers are not allowed

The number of products placed on the watchlist
[Pagename]stringMaximum 255 characters long,
Spaces at the start and end are removed
If the page name is different to the default name, then this page name can be transferred
Note:
Parameters in square brackets [ ] are optional parameters. The basket ID is not yet shown in reports.

Examples:

// Direct call etCommerce.sendEvent('insertToWatchlist', product, 2 ;
// Attached as event etCommerce.attachEvent({'mousedown' : ['insertButton']}, 'insertToWatchlist', product, 2) ;

5.3 removeFromWatchlist – Product removed from watchlist

Using this event you can determine which products were removed from the watchlist.

Function parametersData typeLimitationDescription
'removeFromWatchlist'stringOnly this name is approvedName of the event
Product objectobjectThe object must correspond to the product object description (see Section 6.1)A product object
Numberinteger0 - 65 535
Negative numbers are not allowed
The number of removed products
[pagename]stringMaximum 255 characters long,
Spaces at the start and end are removed
If the page name is different to the default name, then this page name can be transferred
Note:
Parameters in square brackets [ ] are optional parameters.

Examples:

// Direct call etCommerce.sendEvent('removeFromWatchlist', product, 1) ;
// Attached as event etCommerce.attachEvent({'mousedown' : ['removeButton']}, 'removeFromWatchlist', product, 1) ;

5.4 insertToBasket – Product placed into basket

This event is sent when the customer adds a product to their basket.

Function parametersData typeLimitationDescription
'insertToBasket'stringOnly this name is approvedName of the event
Product objectobjectThe object must correspond to the product object description
(see Section 6.1)
A product object
Numberinteger0 - 65 535
Negative numbers are not allowed
The number of products placed into the basket

Examples:

// Direct call etCommerce.sendEvent('insertToBasket', product, 2) ;
// Attached as event etCommerce.attachEvent({'mousedown' : ['insertButton']}, 'insertToBasket', product, 2) ;

5.5 removeFromBasket – Product removed from basket

Using this event you can determine which products were removed from the basket.

Function parametersData typeLimitationDescription
'removeFromBasket'stringOnly this name is approvedName of the event
Product objectobjectThe object must correspond to the product object description (see Section 6.1)A product object
Numberinteger0 - 65 535
Negative numbers are not allowed
The number of removed products

Examples:

// Direct call etCommerce.sendEvent('removeFromBasket', product, 1) ;
// Attached as event etCommerce.attachEvent({'mousedown' : ['removeButton']}, 'removeFromBasket', product, 1) ;

5.6 order – Order

The event transfers the entire order with all order data as well as well as the basket.

Function parametersData typeLimitationDescription
'order'stringOnly this name is allowedName of the event
Order objectobjectThe object must correspond to the product object description - see Section 6.3An order object
currencystringMaximum 3 characters long, spaces at the start and end are removedCurrency according to ISO 4217 e.g.: EUR or USD

Examples:

// Definition of order object var order =  {  orderNumber : 'OrderNumber 1',  status : 'sale',   orderPrice : '1723.60',  basket : {  id : 'basket 1',  products : [  {  product: {  id : '3445',   name : 'Elfrida',   category : ['Animals', 'Big', 'Giraffes', 'Love Giraffes'],   price : '1723.60',  currency : 'EUR',   },  quantity : 1  }] },  customerGroup : 'AnimalLover',  deliveryConditions : 'deliveryConditons',  paymentConditions : 'BigTransport', };
// Direct call etCommerce.sendEvent('order', order) ;
// Attached as Event etCommerce.attachEvent({'mousedown' : ['orderButton']}, 'order', order) ;

5.7 orderConfirmation – Order transferred from Status Lead to Status Sale

This event is sent when an order including all product items is to be transferred from the status “Lead” to the status “Sale”.

Function parametersData typeLimitationDescription
'orderConfirmation'stringOnly this name is approvedName of the event
Order numberstringMaximum 50 characters long,
Spaces at the start and end are removed
The order number of the order for which the status 'Lead' should be transferred to 'Sale'

Examples:

// Direct call etCommerce.sendEvent('orderConfirmation', 'Ordernummer 1');
// Attached as Event etCommerce.attachEvent({'mousedown' :['cancelButton']}, 'orderConfirmation', 'OrderNumber 1') ;

5.8 orderCancellation – Order cancelled

This event is sent when the customer cancels the entire order.

Function parametersData typeLimitationDescription
'oderCancellation'stringOnly this name is approvedName of the event
Order numberstringMaximum 50 characters long, spaces at the start and end are removedThe order number of the order which should be cancelled

Examples:

// Direct call etCommerce.sendEvent('orderCancellation', 'OrderNumber 1') ;
// Attached as event etCommerce.attachEvent({'mousedown' : ['cancelButton']}, 'orderCancellation', 'OrderNumber 1') ;

5.9 orderPartialCancellation – Order partially cancelled

This event is sent when only individual products of an order are sent.

Function parametersData typeLimitationDescription
'orderPartialCancellation'stringOnly this name is allowedName of the event
Order numberstringMaximum 50 characters long, spaces at the start and end are removedThe order number of the order which should be cancelled
Product Objectsarray of objectsThe array must correspond to the products array description.An array which consists of different product objects and the respective amount to be cancelled.

Examples:

// Definition of product objects var products = [  {  product : {  id : '3445',   name : 'Elfrida',   category : ['Animals', 'Big', 'Giraffes', 'Love Giraffes'],   price : '1723.60',   },  quantity: 1 } ];
// Direct call etCommerce.sendEvent('orderPartialCancellation', 'OderNumber 1' , products) ;
// Attached as event etCommerce.attachEvent({'mousedown' : ['partialButton']}, 'orderPartialCancellation', 'OrderNumber 1' , products) ;

6 Event Objects

The product and order information is stored in JavaScript objects. In the following you will find a list of these objects and how they are set up.

6.1 The Product Object

This object defines a product with the respective attributes.

NameAttributeData typeLimitationComment
Product IDidstringMaximum 50 characters long, spaces at the start and end are removedThe product ID is set by you and can be derived from your inventory management system.
Product namenamestringMaximum 255 characters long, spaces at the start and end are removedThe name of the product
Product hierarchy (category)categoryarray of stringsFour hierarchy levels are the maximum that can be illustrated. The array or a category can also be empty.
The hierarchies can be 50 characters long, spaces at the start and end are removed
The product hierarchy is saved in an array,
e.g.: [‘monitors’, '', ‘flat screens’, ‘LED’]
(Nominal) pricepricestringMaximal 20 characters long,
decimal separator is a dot. Spaces at the start and end are removed
The price of the product
CurrencycurrencystringMaximum 3 characters long,
spaces at the start and end are removed
Currency according to ISO 4217
e.g.: EUR or USD
VariantsvariantsObject with key/value pairs The object can be empty.
The variants can be 50 characters long,
spaces at the start and end are removed. Maximum 3 variants
To transfer different versions of a product.
e.g.: {‘colour’: ‘yellow’, ‘sex’: ‘female’, ‘figure’: ‘thin’}

Examples:

// Definition of Product object var product =  {     id      : '3445',      name      : 'Elfrida',      category : ['Animals', 'Big', 'Giraffes', 'Love Giraffes'],      price      : '1723.60',      currency : 'EUR',      variants : {'colour' : 'yellow', 'gender' : 'female', 'figur' : 'thin'} };

6.2 The Basket Object

With an order, the ordered products are placed into a basket object.

NameAttributeData typeLimitationComment
Basket IDidstringMaximum 50 characters long, spaces at the start and end are removedYou set the basket ID
Product Objectsproductsarray of objectsThe array must correspond to the products array description (see following table)The different product objects and the quantity ordered are stored in this array.

The products array contains one or more objects which then themselves consist of product objects and the respective number. This product array is also used with partial cancellations.

NameAttributeData typeLimitationComment
ProductproductobjectThe object must correspond to the product object description.entsprechen.The Product Object
Numberquantityinteger0 - 65 535
Negative numbers are not allowed
The ordered/cancelled amount

Example:

// Definition of shopping-basket object with product-Array var basket =  {  id : '3',  products : [  {  product: {   },  quantity : 2  },  {  product: {   },  quantity : 1  }  ] };

6.3 The Order Object

The object of the order contains all order data and the basket object.

NameAttributeData typeLimitationComment
Order numberorderNumberstringMaximum 50 characters long,
Spaces at the start and end are removed
The unique order number you set. Future cancellations are actuated with this number. Order numbers, which cannot be assigned explicitly to an order, distort the data.
StatusstatusenumContains lead, sale, cancellation or partial_cancellation
Order valueorderPricestringMaximal 20 characters long,
decimal separator is a dot.
Spaces at the start and end are removed
The total order value. As much as possible this should be the sum of the basket value and shipping costs. Discounts, vouchers or special charges due to the payment method, or similar, should be registered as the product object.
CurrencycurrencystringMaximum 3 characters long,
Spaces at the start and end are removed
Currency of the order according to ISO 4217
e.g.: EUR or USD
Shopping basketbasketobject of warenkorbThe object must correspond to the basket object description.The Basket Object
[Customer Group]customerGroupstringMaximum 50 characters long,
Spaces at the start and end are removed
e.g.
- new customer
- existing customer
- big buyer
- VIP
[Delivery Conditions]deliveryConditionsstringMaximum 255 characters long,
Spaces at the start and end are removed
e.g.
- Delivery to the kerb
- Setup on site
- Delivery to the pick-up station/parcel shop/branch
[Payment Conditions]paymentConditionspaymentConditionsMaximum 255 characters long,
Spaces at the start and end are removed
e.g.
- Special payment targets
- Cash discount
- Payment in instalments
Note:
Parameters in square brackets [ ] are optional parameters.

Example:

// Definition of an order-object var order =  {  orderNumber : '234',  status : 'sale',   orderPrice : '5447.2',  currency : 'EUR',   basket : {ShoppingBasket-Object},  customerGroup : ‘Animallovers’,  deliveryConditions : 'Big transport',  paymentConditions : 'Direct cash', }

7 Examples of use

The application areas make clear how the different events for certain actions can be sent to etracker from the website.

7.1 Product page viewed

When opening a product page, the product information should be transferred immediately to etracker. Here, a product object is defined for this. The data is sent directly via the sendEvent function.

Example:

var et_Commerce_basketId = '3'; var et_Commerce_product =  {     id      : '3445',      name      : 'TV 47 Special offer',      category : [‘TV’, 'LCD', '47', 'Special'],      price      : '1723.60',  };   // Product viewed  etCommerce.sendEvent('viewProduct', et_Commerce_product, et_Commerce_basketId);

7.2 Product placed into basket

To record products which are to be placed into the basket (by clicking on the Place in basket button), an event needs to be defined which will be attached to the existing button. Prior to this, a product object which contains the product data needs to be defined. The ID of the button in this case is “ButtonAddToBasket” and the data transfer occurs when the JavaScript event mousedown is triggered. The quantity of products recorded is determined from the ProductQuantity form field saved on the website.

Example:

var et_Commerce_basketId = '3';
var et_Commerce_product =  {  id : '3445',   name : 'TV 47 Special offer',   category : [‘TV’, 'LCD', '47', 'Special'],   price : '1723.60',  };
Var et_Commerce_quantity = Number(document.getElementById('ProductQuantity').value) ;
etCommerce.attachEvent({'mousedown' : ['ButtonAddToBasket']}, 'insertToBasket', et_Commerce_product, et_Commerce_quantity, et_Commerce_basketId);

7.3 Removing a Product from the Basket

To communicate that the customer has removed a product from the basket again, the event removeFromBasket must be called. The data will be sent directly via the sendEvent function.

Example:

var et_Commerce_basketId = '3';
var et_Commerce_product =  {  id : '3445',   name : 'TV 47 Special offer',   category : [‘TV’, 'LCD', '47', 'Special'],   price : '1723.60',  };
etCommerce.sendEvent('removeFromBasket', et_Commerce_product, 1, et_Commerce_basketId]);

7.4 Sending an order with a click

To report an order to etracker by directly clicking on the order button, you need an event order that will be attached to sendOrder. The data will be sent directly via the sendEvent function.

Example:

var basket =  { id : '3', products : [ {  product:   {  id : '3445',   name : 'Elfrida',   category : ['Animals', 'Big', 'Giraffes', 'Love Giraffes'],   price : '1723.60',   },  quantity : 1 }] }
var order =  {  orderNumber : '234',  status : 'sale',   orderPrice : '5447.2',  basket : basket,  customerGroup : ‘Animallover’,  deliveryConditions : 'Big transport',  paymentConditions : 'Direct cash', }
etCommerce.attachEvent( {'mousedown' : ['sendOrder']}, 'order', order);

8 Change log

Hier sind die Änderungen an der Schnittstelle aufgelistet. Die Anwendungsbeispiele verdeutlichen, wie die verschiedenen Events für ausgewählte Aktionen auf der Webseite an etracker gesendet werden können.

8.1 Version 1.1.1

  • Error(s) resolved in debug mode
  • The definition of objects which are triggered by a certain browser event has changed (attachEvent function). From now on, you can define different object IDs in one array using the browser event.
// Old version etCommerce.attachEvent({'mousedown' : 'partialButton'}, 'orderPartialCancellation', 'OrderNumber 1' , products);
// New version with array etCommerce.attachEvent({'mousedown' : ['partialButton', ‘partialButton2’]}, 'orderPartialCancellation', 'OrderNumber 1' , products);

8.2 Version 1.1.3

  • Typography errors fixed in code examples (“onmousedown” change to “mousedown”).

5 Implementing On-Site Campaigns in etracker Analytics

  1. Function and Purpose of On-site Campaigns
  2. Preliminary Considerations for Tracking Website Functions
  3. Preparing to Track the On-site Campaign in the Application
    1. Creating your own Medium and Attributes for the Campaign Link
    2. Configuring your Own Report
  4. Activate Tracking
  5. Generating Internal Campaign Link
  6. Example: On-site Campaign for Tracking the Internal Search

1 Function and Purpose of On-site Campaigns

On-site campaigns are ones which you only run on your website. This means that the success of the campaigns is tracked via internal campaign links which a user clicks on by selecting certain functions on your website. By implementing on-site campaigns in etracker, you can determine how heavily certain website functions are being used, what contribution they make to this success and where there is a need for optimisation.

Typical website functions whose use you can track with etracker:

  • Internal search
  • Banner on homepage or category pages
  • Product recommendations and ‘last viewed items’ boxes
  • Product videos
  • Configurators

Reports for on-site campaigns show which sales the website functions generate or which conversion rates were targeted. Tracking views is not possible.

Note:
If you wish to view multi-level on-site processes in order to analyse exits and conversions across multiple steps and beyond, we recommend configuring website targets with a respective report.
If you want to analyse successes by item, goods groups, main category and subcategory as well as take into account additional views of product detail pages and basket drop-outs, we recommend using the eCommerce API together with the Product Performance Report.

2 Preliminary Considerations for Tracking Website Functions

On-site campaigns should not influence off-site campaigns, that is, the evaluation of the success according to the campaign or referrer origin. To guarantee this, you should create your own attribute set for the on-site campaigns.

The following previously created attributes are required as standard (mandatory attributes).

AttributeParameter (attribute name)Description
Campaign universeetcc_cuDesignation of the campaign universe (limitation of off-site campaigns or testing & targeting campaigns)
On-site mediumetcc_med_onsiteType/Channel of a contact alongside the automatically generated media, for example: name of the website, name of the page, name of the website function
On-site campaignetcc_cmp_onsiteName of the campaign or type of website function

Examples of medium/campaign combinations:

Value(s) mediumValue(s) campaign
On-site campaignCampaign xy
On-site campaignTeaser
container
Internal searchSearch with result
Search without result
Number of search results
TeaserSwitch teaser
Navi teaser
RecommendationsProduct x
Product y
TeaserCampaign xy

Consider which additional attributes you will also require in order to represent the affected website functions and their different characteristics. The best thing to do here is to create user-defined attributes in etracker Analytics. For a distinguishable success analysis you could, for example, use the following attributes:

Website functionUser-defined attributes/parameters
Banner
(on homepage or category pages)
Banner type
Motif
Format
Position

Position
Product recommendations and the ‘last viewed items’ boxesRecommended items
Position in the block
Product videosViewed item
Length
ConfiguratorsFilter (or other settings)

3 Preparing to Record the On-site Campaign in the Application

3.1 Creating your own Medium and Attributes for the Campaign Link

Once you have determined which attributes you will require in addition to the mandatory attributes, create them and, if necessary, create your own value for the Medium attribute. You can do this directly in etracker Analytics under etracker Analytics > Marketing Reports > Campaign > Help Campaigns Link.

3.2 Configuring your own Report

Once you have created all of the required attributes in etracker Analytics, create your personal report for the on-site campaign under etracker Analytics > My Reports > Add Report.

The report should evaluate the success of the on-site campaign and contain the required attributes and respective figures. The following key figures are suitable for an on-site campaign report:

  • Clicks
  • (Direct) visits
  • Leads
  • Lead volume
  • Click lead conversion
  • Sales
  • Sale volume
  • Click-sale conversion

A visitor can open multiple on-site campaigns during a visit and customer journey. In the same way as with off-site campaigns, you can set whether or not the success should be assigned to the first or last on-site campaign you opened.

4 Activate tracking

As soon as the on-site campaign is created in the account, it will still need to be activated as one. Here , please contact the etracker Support at support@etracker.com. Activation is usually within five working days after being requested. In your query, please enter the following information:

  • Name of your report
  • Account ID

5 Generating Internal Campaign Link

The campaign link includes the parameters of the attributes and the relevant attribute values. You can transfer the parameters of the attributes using the control parameter cc_attributes in the tracking code or attach it directly to the internal campaign link.

If you wish to track clicks on product recommendations or on promotional teasers on the homepage, you should adjust the parameters for the attributes directly in the campaign link.

Example for Campaign Link:

http://www.YourSite.de/targetsite.html?etcc_cu=onsite&etcc_med_onsite=Teaser&etcc_cmp_onsite=Eastercampaign&etcc_pos=2

The control parameter cc_attributes supplements the parameters in the campaign link automatically. It needs to be set inside the parameter block, that is, between <!– etracker PARAMETER 4.1 –> <script type=”text/javascript”> and </script> <!– etracker PARAMETER END –>.

This procedure is suitable for, for example, competitions which you link to at multiple places on your website.

Example for cc_attributes:

cc_attributes["etcc_cu"] = "onsite"; cc_attributes["etcc_med_onsite"] = "Onsite contest"; cc_attributes["etcc_cmp_onsite"] = "contest ABC";

6 Example: On-site Campaign for Tracking the Internal Search

Let’s assume you wish to track how successful your internal header search is.

To do so, you can use the Internal Search report in etracker Analytics under the Basic Reports > Content.

6.1 Necessary Parameters

The attributes listed in the table are required for tracking the internal search as standard (mandatory attributes).

AttributeParameter (attribute name)Description
On-site search termetcc_st_onsiteThis attribute needs to be filled dynamically on the results page with the search term.
On-site mediumetcc_med_onsiteTransfer internal search as on-site medium.
On-site search term
etcc_cmp_onsiteThe following values must be transferred to the internal search on the results pages:

On the results page after a successful search:
‘with result’ or ‘successful’.

Or on the results page after a failed search:
‘without result’ or ‘not successful’.
Note:
In the same way, we could create additional attributes in order to, for example, differentiate between the free text searches and clicks on search suggestions.
Generate the campaign link. To do so, transfer the parameters of the attributes in the parameter block of the tracking code. Depending on whether the search results page shows a result or not, you need to transfer different parameters.

6.2  Example Code for the Internal Search

Generic code:

cc_attributes["etcc_cu"] = "onsite"; cc_attributes["etcc_med_onsite"] = "Internal search";  cc_attributes["etcc_cmp_onsite"] = "#Placeholder search result#";  cc_attributes["etcc_st_onsite"] = "#Placeholder search therm#"; 

Code for search phrase ‘School’ (no result):

cc_attributes["etcc_cu"] = "onsite"; cc_attributes["etcc_med_onsite"] = "Internal search";  cc_attributes["etcc_cmp_onsite"] = "without result";  cc_attributes["etcc_st_onsite"] = "School";

Code for search phrase ‘Terminal 1’ (with result):

cc_attributes["etcc_cu"] = "onsite"; cc_attributes["etcc_med_onsite"] = "Internal search";  cc_attributes["etcc_cmp_onsite"] = "with result";  cc_attributes["etcc_st_onsite"] = "Terminal 1";

Alternative code for the transfer (search term ‘Book’, search successful)

var cc_attributes = { 'etcc_med_onsite': 'Internal search', 'etcc_cmp_onsite': 'with result', 'etcc_cu': 'onsite', 'etcc_st_onsite': 'book' };

6 Setting Parameters for etracker Optimiser (et_popto)

With the help of the et_popto parameter, you can avoid flickering effects when viewing pages.

If the browser has loaded too much of the original page by the time etracker delivers the variant, then the original page will be shown briefly before the injection/redirect is executed by etracker. This is perceived as flickering and is usually the result of the browser requesting the page variants from etracker too late. The effect is visible in Chrome mainly because this browser renders very fast and can for this reason display the original page earlier than other browsers.

Note:
The first measure to prevent the flickering effect is to correctly install the tracking code at the very top of the page. This way, you can make sure that the connection to etracker is set up as quickly as possible. Only if the flickering effect persists should you set the parameter et_popto.

A white layer is laid over the page by default before displaying the page. It is removed when the variant is made visible through injection or with a redirect (after 300 milliseconds at the latest). This prevents flickering during the load time.

By setting the et_popto parameter, you can set this timeout to a longer period:

var et_popto     = "2000"; //String: Time until th elayer will be removed (in milliseconds) // max. value: 3000 //Default "300"
Caution:
etracker does not guarantee 100% availability of the etracker Optimiser server. If the server should fail, the white layer will be laid over the page for the set timeout period for every page in which the tracking code is installed. Only after that would the page become visible. For this reason, you should only change the standard value in justifiable cases and test the effect.

7 Tracking Dynamic Content with the Wrapper

With the wrapper, page impressions can also be tracked without expressly opening a website.

7.1 Integrating the Wrapper

The wrapper is delivered with the default JavaScript code of etracker and can be integrated as follows:

<script type="text/javascript"> function testCall(pagename) { et_eC_Wrapper({et_et: accountkey1, et_pagename: pagename}); } </script>

The ‘testCall’ function can then be called using any JavaScript event, for example:

onclick="testCall(pagename)"

The wrapper function can also be called directly without the TestCall function, as follows:

onmousedown="et_eC_Wrapper({et_et: accountkey1, et_pagename: Index-Site});"

So that the call of the wrapper function by the blocked etracker code does not bring about a JavaScript error e.g. by excluding counting, please use the following function:

If(typeof(_etracker) === "object") {  et_eC_Wrapper(…); }

7.2 Wrapper Parameters

‘Account key 1’, the first parameter of the function must contain the Account Key 1 of the etracker Analytics account. The second parameter contains an optional JavaScript object with the following optional variables:

VariableTypeImportanceDescription
et_pagenameStringPage nameUnique name of the page.
et_areasStringArea nameDesignation of the page area.
et_ilevelIntegerVisitor interestNumerical value of the visitor interest in the page. The higher the value, the greater the interest
et_urlString
Browse linkOverwrites the original URL.
et_targetStringWebsite targetDesignation of the website target which should be achieved on the page.
et_tvalFloatTotal order valueOrder status for sales targets:
0 = Lead
1 = Sale
2 = Full reversal
et_tonrStringOrder numberDistinct order number (without commas or semicolons)
et_tsaleIntegerOrder statusOrder status for sales targets:
0 = Lead
1 = Sale
2 = Full reversal
et_custIntegerVisitor statusCustomer status for sales targets
0 = Existing customer
1 = New customer
et_basketStringShopping basketParameter provided by the shop system for assigning basket items (ArtNr,ArtName,ArtGroup,Number,Price)

All object variables are optional. If they are not set explicitly, the values entered in the parameter block of the tracking code will be applied.

The following call generates the same data as the original call via the tracking code:

<script type="text/javascript">et_eC_Wrapper('Account-Key 1');</script>

Example of a complete call:

<script type="text/javascript"> et_eC_Wrapper( { et_et: accountkey, et_url:'http://….', et_pagename:'Landingpage', et_ilevel:2, cc_attributes:{"Attribute name1":"Attribute value1", "Attributname2": ["Attribute value2a", true]}, } ); </script>

8 My Segments

Using your own segments, you can enrich your data on Pages (page impressions), Visitors (users) and Visits (sessions) with additional information (e.g. from your own data sources such as a CRM system). These are transferred to etracker with the help of parameters and allow a more in-depth examination and greater flexibility in analysis.

Note: Before 15 June 2018, only the segment type Visitor (user) could be enriched. All of your own segments that were created before this period are assigned to the segment type User.

8.1 Creating your own Segments

The possibility to create your own segments as well as an overview of your own already created segments can be found at Account Info → Settings → Account → My Segments.

Eigene Segmente - etracker

To create a new segment of your own, enter the segment name that you want to see later in the reports in the Segment Name field.

Then select one of the following options from the segment type drop-down menu:

  • “User”: Add this segment type to enrich user profiles.
  • “Page Impression”: Add this segment type to enrich pages.
  • “Session”: Add this segment type to enrich visits.

Examples for enriching user profiles, page impressions and sessions:

User (visitor)

  • Sociodemographics
  • Customer segment (CRM)
  • Gender

Page Impression (Page)

  • Testing version
  • Customization
  • Template/Pages Type
  • Author
  • Update/Creation
  • Language
  • With/Without video
  • Product rating
  • Keywords
  • Evaluation

Session (Visit)

  • Login status

After filling in the Segment Name and Segment Type fields, click Add to add the segment.

After adding your own segment, it appears in the segment overview. The Parameter (e.g. “et_seg1”) with which you can transfer the segment information is displayed in the Parameter column.

You can define five custom segments by default. An extension is possible at any time, please contact your account manager.

8.2 Value Aliasing (optional)

You have the option to set up aliasing for the transferred segment values in order to be able to transfer a pseudonym in the parameter instead of the clear name. Aliasing the segment values is done via a CSV file (max. 1 MB) which you upload to your corresponding segment and which you can overwrite at any time.

The format is for each list entry: Value, alias (e.g.. x12,female or “x12”,“weiblich”).

After clicking on +-add .csv file, you can navigate to the value file and download it again.

Caution:
Aliasing only applies when saving the file in the application for all future visits by the respective website visitor, but it does not work retroactively.

If values which are not in the aliasing file are transferred to etracker, then these will be listed without alias in the reports.

8.3 Editing your own Segments

You can edit the existing segments by clicking on the pen symbol in the “Actions” column. Here, you can rename your segment, optionally add a CSV file to the value-aliasing or replace an already existing value file.

Please note that adding, replacing or removing a value file only has an effect on the data which is tracked in the future and not on data from previous periods.

Note:  You can not change the segment types of an existing segment.

8.4 Deleting your Segments

To delete your own segment, click on the waste basket symbol in the segment overview. Your segment will no longer be available for selection in the reports.

Caution:
After deleting your own segment it will no longer be available for past periods and it will no longer be possible to view the data of this segment.

8.5 Transferring Segment Information

Once you have created your segments under Account Info > Settings > Account > My Segments, you can transfer the segment information as a parameter in the parameter block of the respective page, as URL parameters or by using a wrapper call.

Example for the transfer in the parameter block with parameters for page call:

var et_seg1="[value]";

Example for the transfer with URL parameters when calling an external link:

http://www.Yoursite.de?etcc_cmp=summer&etcc_med=Display&et_seg1=[value]

Example for the transfer with the wrapper function:

onmousedown="et_eC_Wrapper({et_et: accountkey1, et_pagename: Login-Start, et_seg1: [value]});

8.6 Adding your Segments to the Reports

To apply your segments to the data of a report, click on Segments > Add in the report. You can find your segments in the right-hand column of the segment selection. Select your segment by clicking on the corresponding Segment name.

The segment information in the report will then be shown along with it.

8.7 Example

For visitors to your website, the information as to the gender of the visitor and whether the access to the site was by an internal employee or an external visitor should also be sent to etracker.

Transferring the information on the gender of the visitor should not be done in clear text.

Step 1 – Creating your own Segments:

Two individual segments will be created: ‘gender’ and ‘author’.
For the segment ‘gender’ the values ‘male’ and ‘female’ should be transferred. The segment type ‘User’ is selected, because the user profiles should be enriched.
For the segment ‘author’ the values ‘author Mustermann’ and ‘author Musterfrau’ should be transferred. The segment type ‘Page Impression’ is selected because the page should be enriched.

Step 2 – Creating Values File:

To encode the values for your segment ‘Gender’, a CSV file with the following content will be created:

Here, when transferring the values ‘x12’ and ‘y34’ through etracker, encoding will be done in such a way that these values are then tracked as segment values ‘female’ and ‘male’ and published in the reports.

Step 3 – Uploading Value File:

Upload value file found at Account Info > Settings > Account > My Segment to the ‘Gender’ segment.

Step 4 – Integration of the Parameters for Transferring as Segment Information:

When a female employee views your website, the transfer of parameters in the parameter block of the etracker code then looks as follows:

. . var et_seg1 = "x12"; var et_seg2="intern"; . .

9 Optional parameters

et_vm_reload()

To take dynamic changes to the page content into account when recording with UX Analytics, you can use the etracker tracking code.

var et_cdi

With the help of the etracker parameter et_cdi, a value (identifier) is transferred which is used to identify the website visitor using cross device tracking

var et_blockFB

To disable the display of the page feedback button on certain pages, you can insert the following parameter in the etracker code: var et_blockFB = true;

Vice versa, you can also use the value “false” to make it possible to view the display of the feedback button page.

Parameter block:

<script type="text/javascript"> var et_blockFB = true; </script> <!-- etracker PARAMETER END -->

var et_blockVV
With the help of the et_blockVV parameter you can disable the survey. Here, the parameter must be inserted into the etracker tracking code as follows: var et_blockVV = true;

Vice versa, you can also use the value “false” in order to enable viewing of the visitor voice survey.

Parameter block:

<script type="text/javascript"> var et_blockVV = true; </script> <!-- etracker PARAMETER END -->

var _btNoJquery

There is the option to disable the loading of jQuery by setting the parameter var _btNoJquery = true; in the parameter block of the etracker code. However, this only makes sense if a jQuery loads on the website anyway as smart messages and A/B tests cannot be exported otherwise.

10 Data Protection Information

The etracker tracking technology uses a mixture of first party and third party cookies as well as fingerprinting. Cookies are data which is stored in the browser by the etracker server and can be exported. etracker uses cookies, among other things, to track repeat website visitors. The etracker cookies do not save any personal data or data which could make it possible to trace back to a specific person.

To deal with the customers in a transparent and fair way, we recommend letting the website visitors know that a tracking tool is in use on the website.

A suitable placement for this is the data protection declaration or the company information page on your website. According to the regulations of the German Broadcast Media Act (Telemediengesetz), visitors should also be informed about the fact that personal data is recorded for optimisation purposes and about their right of objection to the use of personal data. For this reason, we recommend adding the following or similar wording into the data protection declaration or the company information of the analysed website:

“On this website, data is collected and stored for marketing and optimisation purposes using the technology of etracker GmbH (<a href=“http://www.etracker.com”>www.etracker.com</a>). With this data, a usage profile can be created under a pseudonym. Additionally, cookies can be added too. Cookies are small text files which are stored locally in the buffer memory of the page visitor’s Internet browser. The cookies make it possible to re-identify the Internet browser.

The data collected with the etracker technology will not be used without the specially granted permission of the person affected to personally identify the visitor to this website and will not be merged together with the personal data of the bearer of the pseudonym. Permission to collect and store data can be revoked at any time with respect to subsequent services.”

You can find this data protection note in your etracker application under Account Info > Account Settings > Objection option via first party cookie and tracking opt-in.

11 Tips and Tricks

11.1 Integrating Tracking Code into CMS and Shop Systems

The etracker tracking code is designed in such a way that it can be inserted easily into any content management or shop system which plans to have a separate layout (template) to the actual content. You only need to insert the code once into the template, which all pages use, and immediately it is available to all pages of the website which were generated using the template.

In the content management and shop systems, upgradeable meta-attributes are usually available which describe the website in greater detail. These kinds of meta-attributes can be referenced using variables of the system within templates. Typical meta-attributes are the page title or the area to which a page is assigned. These and additional etracker parameters can be replaced in this way in the template by the actual values of the meta attributes.

Example:

The page designation is provided in the content management under the variables [pageTitle] in the template. The respective area of the page is made accessible under [areaName]. With the manual code generation the respective variables [pageName] and [areaName] are then inserted for the fields ‘Page name’ and ‘Areas’. You can insert the generated etracker code directly into the template. All of the websites based on this template contain the correct code automatically.

Note:
The content management system must be encoded according to the URL encoding standard upon transferring the variable values.
Ideally, all parameters of the parameter segment should be set by meta-attributes of the content management system. This enables the full control and adaptation of etracker directly from the content management system.

 

b App Analytics tracking framework

  1. Implementation of tracking framework
    1. Implement the Android tracking framework
    2. Handle events
    3. Implement the iOS tracking framework
    4. Handle events
    5. Hybrid app framework
  2. Privacy notice

1 Implementation of tracking framework

1.1 Implement the Android tracking framework

You add the tracking framework to your application as follows:

1. Copy ‘tracking-framework.aar’ to your project’s libs folder.
and add a dependency to your ‘build.gradle’ file like this:

repositories {
        flatDir {
            dirs 'libs'
        }
    }

    dependencies {
        compile(name:'etracker-app-control-XXXXX.XXXXXX', ext:'aar')
    }

If any problems occur with like `com.android.builder.packaging.DuplicateFileException`, please add the following lines to your ‘build.gradle’

packagingOptions {
            exclude "/META-INF/LICENCE"
            exclude "/META-INF/LICENSE"
            exclude "/META-INF/LICENCE.txt"
            exclude "/META-INF/LICENSE.txt"
            exclude "/META-INF/NOTICE"
            exclude "/META-INF/NOTICE.txt"
            exclude "/LICENCE"
            exclude "/LICENCE.txt"
            exclude "/NOTICE"
            exclude "NOTICE.txt"
     }

See also PackagingOptions

To keep a reference to the ‘com.etracker.tracking.Tracker’ instance around, we recommend to create a custom android.app.Application subclass like this:

import android.app.Application;
public class TrackingApplication extends Application {
    private Tracker tracker;
    @Override
    public void onCreate() {
        super.onCreate();
        tracker = Tracker.getInstance(this);
        // Example for accountKey
        String accountKey ="c/vZgay2SaHf8iVpHdFEyFCUB3NDirFUJnpHCGPWKI0=";
        // Example for Api key (API key is optional)
        String apiKey = "d41d8cd98f"; 
        tracker.startTracker(accountKey, apiKey);
    }
    @Override
    public void onTerminate() {
        super.onTerminate();
        tracker.stopTracker();
    }
}
Note:
To avoid any issues with Norton Antivirus or similar products that raise any data privacy concerns, we introduced a new way to initialize the startTracker(), that does not use the Android PackageManager to resolve the app name and app version. Thus the app name and app version is recommend to be provided by using one of the following method signatures.
startTracker(String accountKey, String appName, String appVersion)
startTracker(String accountKey, String sharedSecret, String appName, String appVersion)
startTracker(String accountKey, String sharedSecret, int timeInterval, String appName, String appVersion)

2. Within the created subclass provide the accountKey and, if you want to have the requests signed, the optional API key you got from etracker resp. registered with your account. By default, pending events are sent to the server once every minute.

3. Refer to the above subclass in your AndroidManifest.xml like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...>
    ... 
    <application android:label="@string/app_name" android:icon="@drawable/icon" android:name=".TrackingApplication">
    ... 
    </application>
    ... 
</manifest>

4. As the tracker needs to access the internet, you have to add the INTERNET permission to the AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" ...>
    ...
    <uses-permission android:name="android.permission.INTERNET" />
    ...
</manifest>

5. Access the ‘global com.etracker.tracking.Tracker’ instance in your classes like this:

public class TestActivity extends Activity {
    private Tracker tracker;
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ...
    tracker = Tracker.getInstance(this);
    }
}

6. Before using the tracking service, you should get the visitor’s consent of getting tracked. You can do this by integrating a code snippet in your application like the example below. Via this code snippet the visitor is asked for his consent of getting tracked and the answer is stored by the tracking service. Because of the storage the question is asked only once.

Note:
Please notice that no events are tracked until the visitor’s consent has been given.
if (tracker.getUserConsent() == UserConsent.Unknown) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("Do you allow anonymous tracking?");
    builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialogInterface, int i) {
            tracker.setUserConsent(UserConsent.Granted);
        }
    });
    builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialogInterface, int i) {
            tracker.setUserConsent(UserConsent.Denied);
        }
    });
    builder.create().show();
}

1.2 Handle events

All events are documented in the JavaDoc that is delivered together with the library. The following events are available:

EventDescription
trackScreenViewScreen call.
track OrderSending an InApp order.
trackUserDefinedTracks a custom event.

trackScreenView and trackOrder are convenience events that simplify the use of custom events.

Visitor sessions are determined automatically: Actions in an app within a time interval of 30 minutes are assigned to one visitor session.

To track a screen view event, call trackScreenView(“screenName”) like this:

tracker.trackScreenView("myScreenView");

To track a user defined event, call trackUserDefined() like this:

tracker.trackUserDefined("categoryName", "actionName", "objectName", "42");

If you want to make sure that all pending events are sent to the server now, you can call flush():

tracker.flush();

Data to be transmitted to the server are:

  • For every chunk transmitted to the backend: device model, system version, language code, and country code
  • For each tracked event: timestamp and the string you have chosen to describe the event you want to track.

Like all other methods, this one runs asynchronously. So, if you try to send events just before terminating the application, there might not be enough time to send everything. In that case, events will be sent once the application and therefore the tracker is restarted.

1.3 Implement the iOS tracking framework

You add the tracking framework to your application as follows:

1. Copy ‘ETRTracker.h’ and the associated library ‘libETRTracker.a’ into your application’s project folder. Make sure that your application links against that static library.

2. In your application delegate, import the header file:

#import "ETRTracker.h"

3. Initialize the tracking service in ‘-application:didFinishLaunchingWithOptions:’, provide the accountKey and, if necessary, the optional shared secret (API key) you got from etracker resp. registered with your account. By default, pending events are sent to the server once every minute, but you can provide a different time interval. Just overwrite ‘timeInterval:ETRDefaultTimeInterval’ by your preferred value (in s):

[[ETRTracker sharedTracker] startTrackerWithAccountKey:@"XXXXXX" sharedSecret:@"14a34554" timeInterval:ETRDefaultTimeInterval];

4. Before using the tracking service, you must get user consent to comply with Apple’s terms for application developers. To do this, integrate a code snippet like the following example in your application. By default, user consent is unknown. Due to the code snippet the user will be asked and the tracking service will store the user’s answer. That way, the question is asked only once:

Note:
Please notice that no events are tracked until user consent has been given.
- (void)askForUserConsent {
   if ([[ETRTracker sharedTracker] userConsent] == ETRUserConsentUnknown) {
      UIAlertView *alertView = [[UIAlertView alloc]
         initWithTitle:@""
         message:@"Do you allow anonymous tracking?"
         delegate:self
         cancelButtonTitle:@"No"
         otherButtonTitles:@"Yes", nil];
        [alertView show];
   }
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    ETRUserConsent userConsent = buttonIndex ? ETRUserConsentGranted : ETRUserConsentDenied;
    [[ETRTracker sharedTracker] setUserConsent:userConsent];
}

1.4 Handle events

All events are documented in the header file ETRTracker.h that is delivered together with the library. The following events are available:

EventDescription
trackScreenViewScreen call.
trackOrderSending an InApp order.
trackUserDefinedTracks a custom event.

‘trackScreenView’ and ‘trackOrder’ are convenience events that simplify the use of custom events.

Visitor sessions are determined automatically: Actions in an app within a time interval of 30 minutes are assigned to one visitor session.

To track a screen view event, call -trackScreenView: like this:

[[ETRTracker sharedTracker] trackScreenView:@"shopping card"];

To track a user defined event call trackUserDefined like this:

[[ETRTracker sharedTracker] trackUserDefined:@"category" action:@"action" object:@"object" value:[NSString stringWithFormat:@"%d", 42]];

If you want to make sure that all pending events are sent to the server immediately, you can call -sendPendingEventsNow. The library will attempt to send all pending events up to twelve times with growing delays.

[[ETRTracker sharedTracker] sendPendingEventsNow];

To clean up, we recommend to stop the tracker in -applicationWillTerminate: like this:

[[ETRTracker sharedTracker] stopTracker];

1.5 Hybrid app framework

To track views and visits within a hybrid app it is just necessary, like in regular HTML websites, to implement the regular tracking code which you can find within the settings of your etracker account.

2. Privacy notice

We recommend to include the following privacy statement – or a similar text – when using the etracker technology in your app.

“This app uses etracker technology (<a href=”http://www.etracker.com” >www.etracker.com</a>) to collect visitor behavior data. This data is collected anonymously to be used for marketing and optimization purposes. All visitor data is saved using an anonymous user ID and can be aggregated to a usage profile. The data will not be used to identify a visitor personally and are not aggregated with any personal data. The collection and storage of data may be refused at any time with respect to subsequent services. You can do that under the menu item ‘activate etracker’.” 

 

 

 

 

Need help?
Our friendly, knowledgeable support engineers are here for you.