From b2d08edd4c533990124cbbef9b089d22d24b9b53 Mon Sep 17 00:00:00 2001 From: Nate Benz Date: Mon, 16 May 2022 11:00:46 +0800 Subject: [PATCH] add deprecation warning for top-level key prefixing in GoogleTagManager adapter --- addon/metrics-adapters/google-tag-manager.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/addon/metrics-adapters/google-tag-manager.js b/addon/metrics-adapters/google-tag-manager.js index 255fb6a9..e9578b1d 100644 --- a/addon/metrics-adapters/google-tag-manager.js +++ b/addon/metrics-adapters/google-tag-manager.js @@ -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'; @@ -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) {