Tracking with etracker or Google Analytics
Tracking-code insertion
Klarokratie can optionally insert tracking code for etracker or Google Analytics.
Tracking-code insertion is configured in the site configuration:
config/sites/<site>/config.yaml
When enabled, Klarokratie inserts either the current etracker tracklet or the current Google Analytics tracking code.
Google Analytics
Example configuration:
klarokratie:
googleAnalytics:
enable: true
useTagManager: false
tagId: G-XXXXXXXXXX
| Name | Type | Default |
|---|---|---|
| boolean | false | |
| boolean | false | |
| string | '' |
klarokratie.googleAnalytics.enable
-
- Type
- boolean
- Default
- false
Enables Google Analytics code insertion.
klarokratie.googleAnalytics.useTagManager
-
- Type
- boolean
- Default
- false
Uses Google Tag Manager instead of the Google Analytics tag directly.
klarokratie.googleAnalytics.tagId
-
- Type
- string
- Default
- ''
The tag ID of the Google Analytics or Google Tag Manager account.
etracker
Example configuration:
klarokratie:
etracker:
enable: true
secureCode: ''
blockCookiesOnPageLoad: true
respectDoNotTrack: true
doNotUseSessionStorage: false
| Name | Type | Default |
|---|---|---|
| boolean | false | |
| string | '' | |
| boolean | true | |
| boolean | true | |
| boolean | false |
klarokratie.etracker.enable
-
- Type
- boolean
- Default
- false
Enables etracker code insertion.
klarokratie.etracker.secureCode
-
- Type
- string
- Default
- ''
The secure code of the etracker account.
klarokratie.etracker.blockCookiesOnPageLoad
-
- Type
- boolean
- Default
- true
Enables blocking cookies on page load. This should be active according to GDPR.
klarokratie.etracker.respectDoNotTrack
-
- Type
- boolean
- Default
- true
Respects the Do Not Track browser setting. This should be active according to GDPR.
klarokratie.etracker.doNotUseSessionStorage
-
- Type
- boolean
- Default
- false
Disables session storage.
Warning
Disabling session storage has a negative impact on page and tracking performance.
etracker categories
Klarokratie includes a TypoScript lib object that can be used to set
hierarchical etracker categories through et_areas.
Important
To make the override effective, use COA objects in your
lib override TypoScript.
Example result
The following example can create an etracker category value like:
www.mydomain.com/myProjectName
TypoScript example
lib {
txKlarokratie {
etracker {
domain = COA
domain {
10 = TEXT
10.data = getIndpEnv:HTTP_HOST
}
categoryLevel1 = COA
categoryLevel1 {
30 = RECORDS
30 {
source.data = levelfield: -1 , tx_example_project, slide
tables = tx_example_domain_model_project
conf.tx_example_domain_model_project = TEXT
conf.tx_example_domain_model_project {
field = name
override.field = short_name
}
// Default value if empty
stdWrap.ifEmpty.cObject = COA
stdWrap.ifEmpty.cObject {
10 = TEXT
10.value = Default
}
}
}
}
}
}
Klaro! presets for tracking
The extension includes Klaro! configuration files for etracker and Google Analytics. These files handle cookie opt-in for tracking.
etracker preset:
klarokratie:
klaro:
config: EXT:klarokratie/Resources/Public/Config/KlaroConfigMinimal.js
includes:
- EXT:klarokratie/Resources/Public/Config/Includes/Etracker.js
Google Analytics preset:
klarokratie:
klaro:
config: EXT:klarokratie/Resources/Public/Config/KlaroConfigMinimal.js
includes:
- EXT:klarokratie/Resources/Public/Config/Includes/GoogleAnalytics.js