Wysiwyg.ABTesting
Wysiwyg.ABTesting copied to clipboard
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'
}
}
}