Why is Google Analytics not integrated with Ajax

Basic integration

The etracker tracking code is necessary so that etracker can determine the website usage data (such as visitors and page views) and carry out testing and targeting.

The tracking code must be integrated once into all of the pages on your website to be measured.

This completes the basic integration and the following is automatically recorded:

  • All page views with page title and URL (without URL parameters) with a dwell time accurate to the second and belonging to the navigation areas according to the URL structure
  • All external link calls, download clicks and scroll events
  • 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 capturing data independently of a page impression (e.g. capturing Ajax requests).
  • eCommerceAPI for recording product performance data, orders and transferring new order status (cancellation, 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 timeAccount info → Setup / Tracking Code.

Include tracking code

1. Standard integration

In order for etracker to be able to record the data of your website, the tracking code within the HTML source code must be on all pages to be measured on your website or in the template of your content management or shop system between the opening tag and the closing tag. If you use the etracker Optimiser, we recommend the tracking codeimmediately behind the opening tag or as close as possible to it, in order to minimize flickering 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 – >

Important:

According to the EU directive, the parameterdata-block-cookies = "true" in the tracking code to ensure that no etracker cookies are set by default. You can optionally integrate the function for activating etracker cookies in your cookie notice in order to enable the setting of etracker cookies with consent.

If you use a common consent management solution, note these notes on how they work together so as not to incorrectly block cookie-less tracking.

After installing the tracking code, etracker immediately starts tracking your website.

2. Integration in PHP websites

Use this PHP code for this:

<?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 "et_cdi" => "Y3Jvc3MtZGV2aWNlIGlk", // cross-device identifier ], [ "show_all" => true, // include empty default parameters "slave_codes" => ["CODE01", "CODE02"], // additional secure codes "respect_dnt" => false, // exclude data-respect-dnt attribute "cookie_lifetime" => 3, // identifier cookie lifetime in 30-day spans "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 etracker.inc.zip file.

3. Integration in JSP websites

Use this JSP code to do 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 Sample Usage: <% = etracker.getCode ("YOUR_SECURECODE")%> <% List parameters = new ArrayList (); 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)%> <% = 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.

4. 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 activate the etracker et_eC_Wrapper to call.

Examples:

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

5. 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 changed. When counting page impressions, it is crucial which pages are viewed by visitors in this main frame. Therefore, for a correct counting of the page impressions, it is important to only insert the tracking code on the pages of the frameset that are reloaded in the main frame.

6. Integration in content management and shop systems

For content management or shop systems, the tracking code should be generated manually once and then inserted on the layout template. The parameters of the tracking code are then to be transferred through variables of the content management or shop system.

We also provide plugins for the common shop systems.

7. Integration into the Google Tag Manager

Proceed as follows:

1. Log in to Google Tag Manager with your Google account and password: https://www.google.com/intl/de/tagmanager/

2. Set up an account for a company and click Further.

3. Next, you set up a container for the company's website that will hold the tags for controlling the tracking code. Then click on Create account and container.

4. Accept the Google Tag Manager Terms of Use. A generated container snippet is displayed in the following window.

5. Integrate the container snippet shown in the window on every page of your website as described there.

6. Now build a data layer into your website that contains the etracker parameter values ​​in JavaScript variables. Instructions can be found at: https://developers.google.com/tag-manager/devguide

7. Now click on Add a new tag.

Then on Tag configuration.

And then on Custom HTML tagto add a tag to your container with your etracker tracking code.

8. Activate the checkbox at document.write support. So that the tag can be created, it is now necessary to select a trigger and click on to save to confirm.

Add a trigger rule for All pages added. Copy the tracking code from the etracker application under Settings → Setup / Tracking Code, paste it into the HTML window and adapt it to your website by assigning the variables from your data layer to the JavaScript variables of the tracking code. Finally click on to save.

9. Remove the etracker tracking code from your website and click on Publishto deliver the container to the website with the tag.

Note: Please note that no data is collected between the removal of the tracking code from the website and the publication of the container.

8. Include integration with security headers

In order to integrate the tracking code in connection with content security policy or X-frame options headers, the necessary settings must be made in headers.

9. Tracking code for Google AMP pages

With etracker, it is also possible to track visitors, page impressions (PIs), length of stay as well as entries and exits on AMP pages. To do this, the page must be adjusted in a maximum of two places.

Must first amp-analytics be integrated. This is done in the HTML by adding a ScriptElements in HeadElement loads the appropriate script:

<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. After that, the body-Element amp-analytics with the etracker configuration involved.

<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 code section above, the values ​​for the parameters areas, et and pagename are to be assigned per page as described in the table below:

parameterdescriptionRequired?
etAccount key (unique per account)Yes
pagenameName under which the page can be found in etracker. If not set, the URL of the page is used for it.No
areasAreas to which the page is assigned.No

Tracking of links on non-AMP sites

If the AMP pages contain links to non-AMP pages in the same domain, you probably want to be able to reliably identify visitors coming from an AMP page on traditional pages as well. The following changes must be made for this:

This script ensures that the tracking information created by AMP Analytics reaches etracker.

Additional attributes for AMP-to-non-AMP hyperlinks

To do this, the following attributes must be verbatim in aElements are inserted in the AMP-HTML:

A link to the page looks like this: