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

How can I add custom DataLayer Variables? #28

Open
Gabrielr47 opened this issue May 23, 2019 · 0 comments
Open

How can I add custom DataLayer Variables? #28

Gabrielr47 opened this issue May 23, 2019 · 0 comments

Comments

@Gabrielr47
Copy link

I'm trying to send:

        $analytics.eventTrack('play_game', {
            gameMode: '1',
            playForMoney: true,
        });

but the variables are not showing in the GTM console only the action, what should I do?

I read the code and I thing should have something like

      function eventTrack(action, properties) {
        var dataLayer = window.dataLayer = window.dataLayer || [];
        properties = properties || {};
        dataLayer.push({
          'event': properties.event || 'interaction',
          'target': properties.category,
          'action': action,
          'target-properties': properties.label,
          'value': properties.value,
          'interaction-type': properties.noninteraction,
          'userId': $analyticsProvider.settings.ga.userId,
          ...properties.gtmCustom // <-- the same way they are doing in https://github.com/angulartics/angulartics2/blob/5c478ca09c20ca8bb230f47a5669287fe8fd5f80/src/lib/providers/gtm/gtm.ts#L81
        });

      }
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

1 participant