Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mficzel opened this issue Sep 24, 2019 · 5 comments

Comments

@mficzel
Copy link
Contributor

mficzel commented Sep 24, 2019

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'
        }
    }
} 
@svwu
Copy link
Contributor

svwu commented Sep 24, 2019

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

@mficzel
Copy link
Contributor Author

mficzel commented Sep 24, 2019

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

@breadlesscode
Copy link

breadlesscode commented Sep 25, 2019

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

@svwu
Copy link
Contributor

svwu commented Sep 25, 2019

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.

@jonnitto
Copy link
Contributor

jonnitto commented Feb 7, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants