Comments (5)
@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.
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.
I should not that it should be done in two phases:
- A deprecation warning indicating the new behaviour
- A PR that will remove the old behaviour when we cut the next major
from ember-metrics.
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.
@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 totransaction_id
(when sending to GA4)eventValue
mapped tovalue
eventCurrency
mapped tocurrency
eventItems
mapped toitems
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)
- Resolve ember-beta and ember-canary fails HOT 2
- Deprecate EmberObject Usage? HOT 15
- 😍 TypeScript 😍 HOT 1
- [1.3.0] GoogleTagManager script tag included twice HOT 2
- NOTICE: Intent to rename primary branch HOT 2
- Deprecate Metrics Service `options`
- Support Embroider optimized HOT 2
- Outdated metrics-adapter test blueprint
- Investigate spurious facebook adapter fail
- Refactor Adapter Hook Methods HOT 6
- Support for Google Analytics 4 HOT 7
- Modernize Segment Tests
- `this._adapters` is not iterable in `willDestory` hook
- Breaking changes in 1.4.x HOT 2
- Release 1.5.0 accidentally shipped breaking changes meant for v2? HOT 5
- deprecation message says "This will be removed in Ember 2.0.0"
- Google Tag Manager Crossorigin
- SetCustomVariables for Piwik adapter
- Metrics adapters no longer inject services.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-metrics.