Skip to content

Commit

Permalink
add deprecation warning for top-level key prefixing in GoogleTagManag…
Browse files Browse the repository at this point in the history
…er adapter
  • Loading branch information
opposable-crumbs authored and jherdman committed May 17, 2022
1 parent 55385e6 commit b2d08ed
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion addon/metrics-adapters/google-tag-manager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from '@ember/debug';
import { assert, deprecate } from '@ember/debug';
import { capitalize } from '@ember/string';
import { compact } from 'ember-metrics/-private/utils/object-transforms';
import removeFromDOM from 'ember-metrics/-private/utils/remove-from-dom';
Expand Down Expand Up @@ -48,6 +48,17 @@ export default class GoogleTagManager extends BaseAdapter {
const dataLayer = this.dataLayer;
const gtmEvent = { event: compactedOptions['event'] };

deprecate(
'Future versions of the GoogleTagManagerAdapter will no longer prefix top-level dataLayer keys with `event`. If you wish to retain this behaviour you will need to override the adapter and prefix the keys yourself.',
false,
{
id: 'ember-metrics.issue-438',
for: 'ember-metrics',
since: '1.5.0',
until: '2.0.0',
}
);

delete compactedOptions['event'];

for (let key in compactedOptions) {
Expand Down

0 comments on commit b2d08ed

Please sign in to comment.