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 6 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

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

svwu avatar Sep 24 '19 15:09 svwu

If you have a solution that reads the cookies in the tag manager that is probably better than my example.

mficzel avatar Sep 24 '19 20:09 mficzel

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..

breadlesscode avatar Sep 25 '19 07:09 breadlesscode

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.

svwu avatar Sep 25 '19 08:09 svwu

New path for the JS file: https://github.com/wysiwyg-software-design/Wysiwyg.ABTesting/blob/master/Resources/Private/Script/AbTesting.js

jonnitto avatar Feb 07 '24 15:02 jonnitto