GithubHelp home page GithubHelp logo

Comments (5)

opposable-crumbs avatar opposable-crumbs commented on June 11, 2024 2

@gzurbach sorry, I missed this comment. I basically just implemented what I have in my PR on my local branch. You can override the existing adapter by importing it into app/metrics/google-tag-manager.js and then redefining the trackEvent method.

What you did sounds like it would also work, but I hated the idea of remapping event keys in some other system to account for some weird behavior in my JS. Much more robust to just send the correct data in the first place.

from ember-metrics.

jherdman avatar jherdman commented on June 11, 2024

To be honest, I haven't the foggiest clue. If you look at the first commit with this code you'll see that it's pretty much been there since its inception: 86d7e12.

I'm not a GTM expert so I can't comment on why this might be desirable. I think if you can craft a path forward that offers folks a means of opting into this behaviour we can merge it.

from ember-metrics.

jherdman avatar jherdman commented on June 11, 2024

I should not that it should be done in two phases:

  1. A deprecation warning indicating the new behaviour
  2. A PR that will remove the old behaviour when we cut the next major

from ember-metrics.

opposable-crumbs avatar opposable-crumbs commented on June 11, 2024

Hey @jherdman, I've finally gotten around to this! I've opened the deprecation PR as you can see above. I have the commit for the new behavior ready as well, but I wasn't sure if I should wait to open that one. Don't want to flood you with PRs!

from ember-metrics.

gzurbach avatar gzurbach commented on June 11, 2024

@nbenz Since your 2nd PR is not merged yet, I was wondering how you currently make it all work?

My current implementation to track purchases looks like this:

this.metrics.trackEvent({
  event: 'purchase',
  transaction_id: purchase.id,
  value: purchase.total,
  currency: purchase.currency,
  items: [
    {
      item_id: purchase.itemCode,
      item_name: purchase.label,
    },
  ],
});

Then in GTM, I had to configure 4 user-defined data layer variables:

  • eventTransaction_id mapped to transaction_id (when sending to GA4)
  • eventValue mapped to value
  • eventCurrency mapped to currency
  • eventItems mapped to items

When you say "This breaks Enhanced Ecommerce tracking as it looks for the ecommerce key specifically." are you referring to the fact that you have to map variable names manually in GA4?

from ember-metrics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.