Wysiwyg.ABTesting icon indicating copy to clipboard operation
Wysiwyg.ABTesting copied to clipboard

Add example to pass current decision to the google tag manager to the docs.

Open mficzel opened this issue 5 years ago • 5 comments

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'
        }
    }
} 

mficzel avatar Sep 24 '19 14:09 mficzel