@mparticle/web-adwords-kit 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GoogleAdWordsEventForwarder.common.js +33 -26
- package/package.json +3 -2
- package/CHANGELOG.md +0 -38
|
@@ -55,17 +55,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
55
55
|
|
|
56
56
|
try {
|
|
57
57
|
if (window.gtag && forwarderSettings.enableGtag == 'True') {
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
if (
|
|
59
|
+
forwarderSettings.enableEnhancedConversions ===
|
|
60
|
+
'True' &&
|
|
61
|
+
hasEnhancedConversionData(event.CustomFlags)
|
|
61
62
|
) {
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
window.enhanced_conversion_data =
|
|
64
|
+
parseEnhancedConversionData(
|
|
64
65
|
event.CustomFlags[ENHANCED_CONVERSION_DATA]
|
|
65
66
|
);
|
|
66
|
-
} else {
|
|
67
|
-
console.warn('You have a custom flag of enhanced conversions, but you have not enabled enhanced converisons');
|
|
68
|
-
}
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
sendEventFunction = sendGtagEvent;
|
|
@@ -111,8 +109,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
return 'Can\'t send to forwarder: ' + name + '. Event not mapped';
|
|
114
|
-
}
|
|
115
|
-
catch (e) {
|
|
112
|
+
} catch (e) {
|
|
116
113
|
console.error('Can\t send to forwarder', e);
|
|
117
114
|
return 'Can\'t send to forwarder: ' + name + ' ' + e;
|
|
118
115
|
}
|
|
@@ -126,23 +123,29 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
126
123
|
return 'Can\'t send to forwarder ' + name + ', not initialized. Event added to queue.';
|
|
127
124
|
}
|
|
128
125
|
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
126
|
+
function hasEnhancedConversionData(customFlags) {
|
|
127
|
+
return customFlags && Object.keys(customFlags).length && customFlags[ENHANCED_CONVERSION_DATA];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function parseEnhancedConversionData(conversionData) {
|
|
131
|
+
// Checks if conversion data in custom flags is a stringified object
|
|
132
|
+
// Conversion data should only be a stringified object or a JS object
|
|
133
|
+
if (typeof conversionData === 'string') {
|
|
134
|
+
try {
|
|
135
|
+
return JSON.parse(conversionData);
|
|
136
|
+
} catch (error) {
|
|
137
|
+
console.warn('Unrecognized Enhanced Conversion Data Format', conversionData, error);
|
|
138
|
+
return {};
|
|
139
|
+
}
|
|
140
|
+
} else if (typeof conversionData === 'object') {
|
|
141
|
+
// Not a stringified object so it can be used as-is. However,
|
|
142
|
+
// we want to avoid mutating the original state, so we make a copy.
|
|
143
|
+
return cloneObject(conversionData);
|
|
144
|
+
} else {
|
|
145
|
+
console.warn('Unrecognized Enhanced Conversion Data Format', conversionData);
|
|
146
|
+
return {};
|
|
145
147
|
}
|
|
148
|
+
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
// Converts an mParticle Commerce Event into either Legacy or gtag Event
|
|
@@ -475,6 +478,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
475
478
|
return resObj;
|
|
476
479
|
}
|
|
477
480
|
|
|
481
|
+
function cloneObject(obj) {
|
|
482
|
+
return JSON.parse(JSON.stringify(obj));
|
|
483
|
+
}
|
|
484
|
+
|
|
478
485
|
if (typeof window !== 'undefined') {
|
|
479
486
|
if (window && window.mParticle && window.mParticle.addForwarder) {
|
|
480
487
|
window.mParticle.addForwarder({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mparticle/web-adwords-kit",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"author": "mParticle Developers <developers@mparticle.com> (https://www.mparticle.com)",
|
|
5
5
|
"description": "mParticle integration sdk for Google Adwords",
|
|
6
6
|
"main": "dist/GoogleAdWordsEventForwarder.common.js",
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
"repository": "https://github.com/mparticle-integrations/mparticle-javascript-integration-adwords",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "rollup --config rollup.config.js",
|
|
14
|
+
"build:test": "rollup --config rollup.test.config.js",
|
|
14
15
|
"watch": "rollup --config rollup.config.js -w",
|
|
15
|
-
"test": "
|
|
16
|
+
"test": "npm run build && npm run build:test && DEBUG=false karma start test/karma.config.js"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
19
|
"chai": "^4.2.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# [2.2.0](https://github.com/mparticle-integrations/mparticle-javascript-integration-adwords/compare/v2.1.1...v2.2.0) (2021-11-11)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Features
|
|
5
|
-
|
|
6
|
-
* Add support for enhanced conversions ([7c3c5d6](https://github.com/mparticle-integrations/mparticle-javascript-integration-adwords/commit/7c3c5d6092b0574c3f54ca5651c27a2b3d8edb4c))
|
|
7
|
-
|
|
8
|
-
## [2.1.1](https://github.com/mparticle-integrations/mparticle-javascript-integration-adwords/compare/v2.1.0...v2.1.1) (2021-11-11)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Bug Fixes
|
|
12
|
-
|
|
13
|
-
* Correct send_to in gtag API ([#23](https://github.com/mparticle-integrations/mparticle-javascript-integration-adwords/issues/23)) ([af01adc](https://github.com/mparticle-integrations/mparticle-javascript-integration-adwords/commit/af01adc2b04453f77845e228bff4aa6c49824fde))
|
|
14
|
-
* Prevent unmapped events from being forwarded ([#22](https://github.com/mparticle-integrations/mparticle-javascript-integration-adwords/issues/22)) ([50e6d27](https://github.com/mparticle-integrations/mparticle-javascript-integration-adwords/commit/50e6d279dff666f5621e585878672707a21d911f))
|
|
15
|
-
|
|
16
|
-
## Releases
|
|
17
|
-
--
|
|
18
|
-
|
|
19
|
-
#### 2.1.0 - 2021-10-25
|
|
20
|
-
* Implement Google Site Tag (GTAG) support as an opt-in feature
|
|
21
|
-
|
|
22
|
-
#### 2.0.5 - 2020-11-11
|
|
23
|
-
* There are no code changes in this commit. NPM published 2.0.4 but with the dist/ file from 2.0.3. This commit will include the correct dist/ file as we bump to 2.0.5
|
|
24
|
-
|
|
25
|
-
#### 2.0.4 - 2020-11-10
|
|
26
|
-
* Bugfix - Check window for node environments
|
|
27
|
-
* Bugfix - rename event --> adWordEvent
|
|
28
|
-
|
|
29
|
-
#### 2.0.3 - 2020-02-03
|
|
30
|
-
* Update package.json
|
|
31
|
-
|
|
32
|
-
#### 2.0.2 - 2019-10-03
|
|
33
|
-
* Bugfix - Remove parseInt(conversionId) which could result in NaN and data not sent to AdWords
|
|
34
|
-
* Turn src file into an ESM module
|
|
35
|
-
* Remove isObject dependency
|
|
36
|
-
|
|
37
|
-
#### 2.0.1 - 2019-08-12
|
|
38
|
-
* Bugfix - Refactor calculateJSHash
|