Basic integration
The etracker tracking code is required so that etracker can determine the usage data of the website (e.g. visitors and page views).
The tracking code must be integrated once into all pages of your website to be measured.
This completes the basic integration and the following is recorded automatically:
- All page views with page title and URL (without URL parameters) with dwell time to the second and assignment to the navigation areas according to the URL structure
- All external link calls, download clicks and scroll events
- Videos, podcasts, music (playable media)
- Use of the internal search after defining the search parameter
- Allocation of visits by medium (type-in, SEO/SEA, social media, referrer)
- Google Analytics (UTM) campaign parameters (as origin, medium, campaign)
- All organic referrers (domain and path)
Optionally, you can also fill in the etracker parameters contained in the tracking code.
For special evaluations and reports, additional data can be transferred via interfaces, which must also be integrated into the website to be measured. The following interfaces are available:
- JavaScript wrapper for recording data independently of a page impression (e.g. recording Ajax requests).
- E-commerce API for recording product performance data, orders and transferring new order statuses (cancelation, lead to sales).
Your tracking code
The tracking code contains a unique key value for each account. Your personal tracking code will be displayed after you log in for the first time. You can also find it at any time under Integration → Website code.
Insert tracking code
Standard integration
In order for etracker to collect the data from your website, the tracking code must be inserted within the HTML source code on all pages of your website to be measured or in the template of your content management or store system between the opening <head>
tag and the closing </head>
tag.
If you use the etracker optimizer, we recommend inserting the tracking code directly after the opening <head>
tag or as close to it as possible to minimize flickering effects when a page is called up.
The tracking code is structured as shown in the example below:
<!-- Copyright (c) 2000-2021 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 5.0 -->
<script type="text/javascript">
// var et_pagename = "";
// var et_areas = "";
// var et_tval = 0;
// var et_tsale = 0;
// var et_tonr = "";
// var et_basket = "";
</script>
<script id="_etLoader" type="text/javascript" charset="UTF-8" data-block-cookies="true" data-respect-dnt="true" data-secure-code="XXXXX" src="//code.etracker.com/code/e.js" async></script>
<!-- etracker tracklet 5.0 end -->
In accordance with the EU directive, the parameter data-block-cookies=“true“
in the tracking code ensures that no etracker cookies are set by default.
Optionally, you can integrate the function for activating etracker cookies in your cookie notice to enable the setting of etracker cookies with consent.
If you are using a common consent management solution, follow these instructions for the interaction so as not to incorrectly block cookie-less tracking.
If you use the etracker Optimiser add-on, an additional attribute must be added to the tracking code on the websites where A/B tests, sticky bars or pop-ups are displayed:
data-enable-eo="true"
The tracking code for these pages then looks like this in the standard system:
<!-- Copyright (c) 2000-2022 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 5.0 -->
<script type="text/javascript">
// var et_pagename = "";
// var et_areas = "";
// var et_tval = 0;
// var et_tsale = 0;
// var et_tonr = "";
// var et_basket = "";
</script>
<script id="_etLoader" type="text/javascript" charset="UTF-8" data-block-cookies="true" data-respect-dnt="true" data-enable-eo="true" data-secure-code="XXXXX" src="//code.etracker.com/code/e.js" async></script>
<!-- etracker tracklet 5.0 end -->
After installing the tracking code, etracker immediately starts tracking your website.
Integration in 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", ["et_pagename" => "YOUR_PAGENAME", "et_areas" => "YOUR_AREA1/AREA2"]);
// base code for campaign / target pages
echo etracker::getCode(
"YOUR_SECURECODE",
[
"et_pagename" => "YOUR_PAGENAME", // pagename
"et_areas" => "YOUR_AREA1/AREA2", // slash delimited area 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_basket" => "ARTICLE1,DESCRIPTION1,GROUP1,AMOUNT1,PRICE1", // shopping cart
],
[
"show_all" => true, // include empty default parameters
"slave_codes" => ["CODE01", "CODE02"], // additional secure codes
"respect_dnt" => false, // exclude data-respect-dnt at
"cookie_upgrade_url" => "https://example.com/cookie-upgrade.php", // cookie upgrade URL
"block_cookies" => true, // do not set cookies
"banner" => "etracker tracklet", // used to customize banner comment
]
);
?>
Here you can download the file etracker.inc.zip.
Integration in JSP websites
Use this JSP code for this:
CountingParameter Overview:
Parameter.PAGE_NAME - String
Parameter.AREAS - String
Parameter.ILEVEL - Integer
Parameter.VALUE - Double
Parameter.SALE - Integer
Parameter.ORDER_NR - String
Parameter.LPAGE - Integer
Parameter.CUSTOMER - Boolean
Parameter.BASKET - String
Parameter.SUB_CHANNEL - String
Parameter.CDI - String
Parameter.CC_ATTRIBUTES - Map<String, Object>
Sample Usage:
<!-- 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 and options set -->
<%=etracker.getCode(
"YOUR_SECURECODE",
parameters,
new TrackingOptions()
.setShowAll(true) // include empty default parameters
.setSlaveCodes(new String[] { "CODE01", "CODE02" }) // additional secure codes
.setRespectDNT(false) // exclude data-respect-dnt attribute
.setCookieLifetime(3) // identifier cookie lifetime in 30-day spans
.setCookieUpgradeURL("https://example.com/cookie-upgrade.php") // cookie upgrade URL
.setBlockCookies(false) // do not set cookies
.setBanner("etracker tracklet") // used to customize banner comment
)%>
Download the file etracker-bean.jar (version 5.0) here.
Integration in Flash websites
Here we show you examples in ActionScript 2.0 and ActionScript 3.0 to integrate the tracking code into Flash websites.
Use the ExternalInterface.call method to call the etracker function et_eC_Wrapper
from Flash.
ExternalInterface.call("et_eC_Wrapper", "Key", "Seitename", "Bereich");
ExternalInterface.call("et_eC_Wrapper", "Key", "Seitename", "Bereich",
"ilevel", "URL", "Target", "tval", "Ordernr",
"tsale", "Customer", "Basket";
Integration in frames
A frameset usually consists of several small frames (e.g. with menus, copyright notices and titles) and a large main frame in which the actual content is displayed. If the visitor selects a menu item, the content of the main frame is replaced. When counting page impressions, it is crucial which pages are accessed by visitors in this main frame. It is therefore important for correct counting of page impressions that the tracking code is only inserted on the pages of the frameset that are reloaded in the main frame.
Integration into content management and store systems
For content management or store systems, the tracking code should be generated manually once and then inserted into the layout template. The parameters of the tracking code should then be transferred using variables of the content management or store system.
We also provide plugins for the most common store systems.
Install integration with security headers
To increase the security of web applications, it is good practice to use HTTP security headers.
This includes the Content-Security-Policy
header (CSP).
To use the tracking code on a server with activated CSP, the CSP header for etracker must be supplemented as follows:
Header set Content-Security-Policy "script-src 'self' https://*.etracker.com https://*.etracker.de 'unsafe-inline'; connect-src https://*.etracker.de; img-src 'self' https://*.etracker.com https://*.etracker.de"
When using the scrollmap, embedding in an iframe should also be permitted:
Header set Content-Security-Policy "frame-ancestors https://*.etracker.com; script-src 'self' https://*.etracker.com https://*.etracker.de 'unsafe-inline'; connect-src https://*.etracker.de; img-src 'self' https://*.etracker.com https://*.etracker.de"
The “unsafe-inline
” restriction can be removed if the etracker parameter block in the website and the CSP are provided with the same randomly generated nonce when the page is delivered.
Tracking code for Google AMP pages
With etracker, it is also possible to track visitors, page impressions (PIs), dwell time and entries and exits on AMP pages. To do this, the page must be adjusted in a maximum of two places.
First, amp-analytics must be integrated. To do this, the corresponding script is loaded in the HTML by adding a script element in the head element:
<head>
<script async
custom-element="amp-analytics"
src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js">
</script>
</head>
If several analysis tools are used at the same time (e.g. etracker and Google Analytics), the script only needs to be loaded once. Then amp-analytics is integrated in the body element with the etracker configuration.
<body>
<amp-analytics config="https://code.etracker.com/amp-config.json.php">
<script type="application/json">
{
"vars": {
"areas": "AMP-Beispielbereich",
"et": "M632hA",
"pagename": "AMP-Beispielseite"
}
}
</script>
</amp-analytics>
</body>
In the above code section, the values for the parameters areas
, et
and pagename
must be assigned per page as described in the table below:
Parameter | Beschreibung | Erforderlich? |
---|---|---|
et | Account-Schlüssel (eindeutig pro Account) | ja |
pagename | Name, unter dem die Seite in etracker zu finden ist. Wenn nicht gesetzt, wird die URL der Seite dafür verwendet. | nein |
areas | Bereiche, denen die Seite zugeordnet ist. | nein |