Skip to content

Measure single-page applications

Content
Automatic wrapper function Manual installation of the wrapper Parameters of the wrapper General notes on the wrapper function

In a single-page application (SPA), only a single HTML page is loaded and the content is then updated using JavaScript APIs to change the displayed content. These changes are not measured as new page views by default. It is therefore necessary to generate virtual page views for this.

There are two methods for measuring virtual page views:

  1. Automatic wrapper function.
  2. Manual installation of the wrapper.

Automatic wrapper function

Certain changes can be recognized automatically and used to trigger the measurement of a new page view. To do this, the following addition must be made to the etracker code integrated in the website:

data-page-changed-detection=<Modus>

These options are available for the mode:

  1. off: Off.
  2. url: Triggers a new page request if the URL changes without a hash value.
  3. url_debug: Like url, but can only be read in the console.log of the browser DevTools.
  4. hash: Triggers a new page request if the URL including the hash value changes.
  5. hash_debug: Like hash, but can only be read in the console.log of the browser DevTools.
  6. title: Triggers a new page call if document.title changes .
  7. title_debug: Like title, but can only be read in the console.log of the browser DevTools.

Manual installation of the wrapper

The wrapper is delivered with the standard JavaScript code from etracker and can be installed like this, for example:

javascript
<script>
    function testCall(){
        if(typeof(_etracker) === 'object') {
            et_eC_Wrapper({et_et: 'ACCOUNTSCHLÜSSEL', et_pagename: 'pagename', et_areas: 'Bereich1/Bereich2/Bereich3', et_seg1: 'Eigenes Segment 1'});
        }
    }
</script>

To ensure that the call of the wrapper function does not lead to a JavaScript error due to any blocked etracker code, e.g. by excluding it from the count. To ensure that calling the wrapper function does not lead to a JavaScript error due to any blocked etracker code, e.g. exclusion from counting, the presence of the etracker object is first checked with typeof .

Parameters of the wrapper

The parameter et_et for the account key is a mandatory parameter. All other parameters are optional:

VariableTypeBedeutungBeschreibung
et_pagenameStringSeitennameEindeutiger Name der Seite
et_areasStringBereichsnameBezeichnung des Seitenbereichs
et_tvalFloatGesamtbestellwertNettoumsatz, der durch die Zielerreichung generiert wurde
et_tonrStringBestellnummerEindeutige Bestellnummer (ohne Kommas und Semikolons)
et_tsaleIntegerBestellstatusBestellstatus für Umsatzziele:
0 = Lead
1 = Sale
2 = Vollstorno
et_basketStringWarenkorbVom Shopsystem vergebene Parameter zum Zuordnen der Warenkorbartikel (ArtNr, ArtName, ArtGruppe, Anzahl, Preis)
cc_attributesStringKampagnen-AttributeAttributname und Attributwert für Kampagnen
et_seg1 StringEigenes SegmentInhalt des eigenen Segments

If the optional parameters are not explicitly set, the values that were transmitted to etracker the last time the page was accessed are used. The values can be transmitted via the standard tracking code when the page is called up in the browser or via the wrapper when the page is loaded dynamically.

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

javascript
<script>
    if(typeof(_etracker) === 'object') {
        et_eC_Wrapper({et_et: 'ACCOUNTSCHLÜSSEL'});
    }
</script>
Beispiel für einen vollständigen Aufruf javascript
<script>
    if(typeof(_etracker) === 'object') {
        et_eC_Wrapper(
            {
                et_et: 'ACCOUNTSCHLÜSSEL',
                et_pagename:'Suchergebnisse',
                et_areas: 'DE/Suche',
                cc_attributes:{etcc_cu:'onsite',etcc_med_onsite:'Interne Suche',etcc_cmp_onsite:'Mit Ergebnis',etcc_st_onsite:'Stiefel'},
                et_seg1: 'eingeloggt',
                et_seg2: 'B2B'
            }
            );
        }
</script>

General notes on the wrapper function

Recording events in interaction with the wrapper

If events are transmitted to etracker as part of etracker event tracking, they are assigned to the page name that was last transmitted to etracker before the event was triggered. If, for example For example, if a page view was first triggered using a wrapper and then an event was tracked, the event is assigned in the evaluation to the page name that was transmitted to etracker with the wrapper.

Capturing URLs in interaction with the wrapper

Since no URL can be transmitted to etracker via the wrapper, etracker always assigns the page views that are transmitted to etracker via the wrapper to the URL that is stored in the document.location.href property.

Bitte beachte:

A unique URL is not available for the evaluation of SPAs. However, in order to ensure a clear evaluation of the individual contents, particular care should be taken to ensure that each virtual page is given a unique page name that is easy to understand in the evaluation.

If this is not possible due to the large amount of content or for other reasons, we recommend that you do not use speaking page names, but instead transmit virtual page paths via the parameter et_pagename .