Scout24/showcar-tracking

Name: showcar-tracking

Owner: AutoScout24

Owner: AutoScout24

Description: null

Created: 2015-10-12 16:33:33.0

Updated: 2016-10-27 08:47:29.0

Pushed: 2018-02-01 12:35:38.0

Homepage: null

Size: 341

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

showcar-tracking

Tracking library for ShowCar-based pages.

Track actions that cause page loads

If you need to track a click on an element that will cause the browser to load another page, you should use the query parameters ipl and ipc. As you can see here:

http://www.autoscout24.de/auto-verkaufen/?ipc=cc:insertion-home&ipl=teaser

Example: Tracking of the CMS box containing price estimation IPC: home-cmsbox IPL: vehicle-evaluation

GTM will automatically take care of tracking the given values. You just have to insert the two parameters into the URL of the target of the action. e.g. in the href-attribute of a link.

Tracking with custom elements

It's possible to do all the tracking with custom HTML elements. In order to accomplish that, you'll have to use the <as24-tracking> element. To control tracking you use a set of attributes.

There are a couple of common attributes that are used to control the behavior of the custom element:

All other attributes are used as key-value pairs for tracking. They override values given by the as24-tracking-value attribute.

If you need to use upper case characters (according to the gtm variable) inside an attribute name, you need to escape them with a leading dash. Example: group_myTestAttribute is written as <as24-tracking group_my-test-attribute="value">

Page view

Custom element way:

4-tracking type="pagename" country="de" market="all-webapp" category="all"></as24-tracking>
4-tracking type="gtm" action="pageview"></as24-tracking>

JavaScript way:

ush(['pagename', {
    "country": "de",
    "market": "all-webapp",
    "category": "all",
    "pageid": "home",
    "layer": "",
    "attribute": null,
    "group": null,
    "environment": "live",
    "language":"de"
}]);
ush(['gtm', 'pageview']);    
Click tracking (without page load)

Custom element way:

4-tracking type="gtm" action="click" as24-tracking-click-target="#myButton" linkgroup="HackList" linkid="V1 (abundance)"></as24-tracking>

JavaScript way:

ush(['gtm', 'click', {
linkgroup: 'HackList',
linkid: 'V1 (abundance): ' + itemId + '|' + abundance

Extended click tracking (e.g. for page load)

Click tracking is possible for any as24-tracking tag, simply add the attribute as24-tracking-click-target. Its value needs to be a valid selector.

Setting values

Custom element way:

4-tracking type="gtm" action="set" test_experiments.tt5="NetGross:Variation1" />

JavaScript way:

ush(['gtm', 'set', {'test_experiments.tt5': 'NetGross:Variation1'}]);
Dealer tracking

Custom element way:

4-tracking type="dealer" action="listview" as24-tracking-value="[281705316,281702707,281462097,281725748,237276348,281667368,281673373,281661776,281555953,281095563]"/>

JavaScript way:

ush(['dealer', 'listview', [281705316,281702707,281462097,281725748,237276348,281667368,281673373,281661776,281555953,281095563]]);

Aggregated Dealer Tracking (e.g. on list page):

If you want to make sure to only send out one request for more than one tracking item you can use the dealer tracking this way:

4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="commit"></as24-tracking>

showcar-tracking

Tracking library for ShowCar-based pages.

Track actions that cause page loads

If you need to track a click on an element that will cause the browser to load another page, you should use the query parameters ipl and ipc. As you can see here:

http://www.autoscout24.de/auto-verkaufen/?ipc=cc:insertion-home&ipl=teaser

Example: Tracking of the CMS box containing price estimation IPC: home-cmsbox IPL: vehicle-evaluation

GTM will automatically take care of tracking the given values. You just have to insert the two parameters into the URL of the target of the action. e.g. in the href-attribute of a link.

Tracking with custom elements

It's possible to do all the tracking with custom HTML elements. In order to accomplish that, you'll have to use the <as24-tracking> element. To control tracking you use a set of attributes.

There are a couple of common attributes that are used to control the behavior of the custom element:

All other attributes are used as key-value pairs for tracking. They override values given by the as24-tracking-value attribute.

If you need to use upper case characters (according to the gtm variable) inside an attribute name, you need to escape them with a leading dash. Example: group_myTestAttribute is written as <as24-tracking group_my-test-attribute="value">

Page view

Custom element way:

4-tracking type="pagename" country="de" market="all-webapp" category="all"></as24-tracking>
4-tracking type="gtm" action="pageview"></as24-tracking>

JavaScript way:

ush(['pagename', {
    "country": "de",
    "market": "all-webapp",
    "category": "all",
    "pageid": "home",
    "layer": "",
    "attribute": null,
    "group": null,
    "environment": "live",
    "language":"de"
}]);
ush(['gtm', 'pageview']);    
Click tracking (without page load)

Custom element way:

4-tracking type="gtm" action="click" as24-tracking-click-target="#myButton" linkgroup="HackList" linkid="V1 (abundance)"></as24-tracking>

JavaScript way:

ush(['gtm', 'click', {
linkgroup: 'HackList',
linkid: 'V1 (abundance): ' + itemId + '|' + abundance

Extended click tracking (e.g. for page load)

Click tracking is possible for any as24-tracking tag, simply add the attribute as24-tracking-click-target. Its value needs to be a valid selector.

Setting values

Custom element way:

4-tracking type="gtm" action="set" test_experiments.tt5="NetGross:Variation1" />

JavaScript way:

ush(['gtm', 'set', {'test_experiments.tt5': 'NetGross:Variation1'}]);
Dealer tracking

Custom element way:

4-tracking type="dealer" action="listview" as24-tracking-value="[281705316,281702707,281462097,281725748,237276348,281667368,281673373,281661776,281555953,281095563]"/>

JavaScript way:

ush(['dealer', 'listview', [281705316,281702707,281462097,281725748,237276348,281667368,281673373,281661776,281555953,281095563]]);

Aggregated Dealer Tracking (e.g. on list page):

If you want to make sure to only send out one request for more than one tracking item you can use the dealer tracking this way:

4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="add" as24-tracking-value='{ "id": 123, "guid": "asdsad-sd-f23-4-2", "tier": "t20" }'></as24-tracking>
4-tracking type="dealer-gtm" action="commit"></as24-tracking>

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.