1. Home
  2. Docs
  3. Integration & Setup
  4. Tracking Code & SDKs
  5. Tracking Code Integration
  6. Dynamic content: Wrapper

Dynamic content: Wrapper

Using the wrapper, virtual page views can be measured even without explicitly calling up a web page. In this way, single page applications (SPAs) can also be measured in a differentiated manner, i.e. websites that load a single HTML page and update it dynamically without reloading it.

Installing the wrapper

<script>
    function testCall(){
        if(typeof(_etracker) === 'object') {
            et_eC_Wrapper({et_et: 'ACCOUNTKEY', et_pagename: 'pagename', et_areas: 'area1/area2/area3', et_seg1: 'own segment 1'});
        }
    }
</script>

To avoid that the call of the wrapper function by possibly blocked etracker code (e.g. by excluding it from the count) leads to a JavaScript error, the presence of the etracker object is first checked with typeof.

Parameters of the wrapper

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

VariableTypeImportanceDescription
et_pagenameStringPage nameUnique name of the page.
et_areasStringArea nameDesignation of the page area.
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_basketStringShopping basketParameter provided by the shop system for assigning basket items (ArtNr,ArtName,ArtGroup,Number,Price)
cc_attributesStringCampaign attributesAttribute name and attribute value for campaigns
et_seg1StringOwn segmentContent of the own segment

If the optional parameters are not explicitly set, the values that were transmitted to etracker during the last page load 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:

<script>
    if(typeof(_etracker) === 'object') {
        et_eC_Wrapper({et_et: 'ACCOUNTKEY'});
    }
</script>

Example of a complete call:

<script>
    if(typeof(_etracker) === 'object') {
        et_eC_Wrapper(
            {
                et_et: 'ACCOUNTKEY',
                et_pagename:'search results',
                et_areas: 'EN/search',
                cc_attributes:{etcc_cu:'onsite',etcc_med_onsite:'Internal search',etcc_cmp_onsite:'With result',etcc_st_onsite:'Boots'},
                et_seg1: 'logged in',
                et_seg2: 'B2B'
            }
            );
        }
</script>

General notes on the wrapper function

Capture of 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, a page request was first triggered using the wrapper and an event was tracked thereafter, the event is assigned in the evaluation to the page name that was transmitted to etracker with the wrapper.

Capture of URLs in interaction with the wrapper:

No URL can be transmitted to etracker by using the wrapper function. When using the wrapper function etracker always assigns the page views to the URL that is stored in the document.location.href property.

Notes for the use of the wrapper with Single Page Applications (SPAs)

A unique URL is not available for the evaluation of SPAs. In order to nevertheless ensure a clear evaluation of the individual contents, special care should be taken to make sure that each virtual page is given a unique page name that can be easily traced 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 to etracker via et_pagename.