Add example to pass current decision to the google tag manager to the docs.
After some experiments i found this solution to pass the current decisions to the google tag manger where it is used to define the dimensions for GoogleAnalytics. This or a better pattern should/could be in the readme as way for evaluating the tests.
prototype(Vendor.Site:Integration.GoogleTagManager.DataLayer) < prototype(Neos.Fusion:Component) {
data = Neos.Fusion:DataStructure {
ab_features = ${ Wysiwyg.ABTesting.Decisions.getAllDecisions() }
}
renderer = afx`
<script @if.hasValue={props.data}>
dataLayer = [{Json.stringify(props.data)}];
</script>
`
@cache {
mode = 'uncached'
context {
1 = 'site'
}
}
}
Hi Martin, You are right, we didnt mentioned it right now - we also have a script to read out the cookies via javascript.
Thank you for your example and integration-pattern this is an aspect we should add soonish
If you have a solution that reads the cookies in the tag manager that is probably better than my example.
If you have a solution that reads the cookies in the tag manager that is probably better than my example.
https://github.com/wysiwyg-software-design/Wysiwyg.ABTesting/blob/master/Resources/Public/JavaScript/AbTesting.js
@svwu We have to document this JS-Class..
Please note that we have to optimize this as the CookieName is currently hardcoded.
This doesn't fit the current option of changing the CookieName via settings. Thats why I like the way of martin pretty well as it uses all functions aswell.
Implementation Objects / Patterns would be one point we should actualy aim for. Let's talk about it in detail, later to define implementation patterns or find out how good they fit for this package.
New path for the JS file: https://github.com/wysiwyg-software-design/Wysiwyg.ABTesting/blob/master/Resources/Private/Script/AbTesting.js