@splitsoftware/splitio-commons 1.6.0 → 1.6.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/CHANGES.txt +3 -0
- package/cjs/integrations/ga/GaToSplit.js +4 -2
- package/cjs/integrations/ga/GoogleAnalyticsToSplit.js +1 -0
- package/esm/integrations/ga/GaToSplit.js +4 -2
- package/esm/integrations/ga/GoogleAnalyticsToSplit.js +1 -0
- package/package.json +1 -1
- package/src/integrations/ga/GaToSplit.ts +3 -2
- package/src/integrations/ga/GoogleAnalyticsToSplit.ts +1 -1
- package/types/integrations/ga/GoogleAnalyticsToSplit.d.ts +1 -1
package/CHANGES.txt
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
1.6.1 (July 22, 2022)
|
|
2
|
+
- Updated GoogleAnalyticsToSplit integration to validate `autoRequire` config parameter and avoid some wrong warning logs when mapping GA hit fields to Split event properties.
|
|
3
|
+
|
|
1
4
|
1.6.0 (July 21, 2022)
|
|
2
5
|
- Added `autoRequire` configuration option to the Google Analytics to Split integration, which takes care of requiring the splitTracker plugin on trackers dynamically created by Google tag managers (See https://help.split.io/hc/en-us/articles/360040838752#set-up-with-gtm-and-gtag.js).
|
|
3
6
|
- Updated browser listener to push remaining impressions and events on 'visibilitychange' and 'pagehide' DOM events, instead of 'unload', which is not reliable in modern mobile and desktop Web browsers.
|
|
@@ -64,7 +64,9 @@ function mapperBuilder(mapping) {
|
|
|
64
64
|
var fields = mapping.eventProperties[hitType];
|
|
65
65
|
if (fields) {
|
|
66
66
|
for (var i = 0; i < fields.length; i++) {
|
|
67
|
-
|
|
67
|
+
var fieldValue = model.get(fields[i]);
|
|
68
|
+
if (fieldValue !== undefined)
|
|
69
|
+
properties[fields[i]] = fieldValue;
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
return {
|
|
@@ -247,6 +249,6 @@ function GaToSplit(sdkOptions, params) {
|
|
|
247
249
|
return SplitTracker;
|
|
248
250
|
}());
|
|
249
251
|
// Register the plugin, even if config is invalid, since, if not provided, it will block `ga` command queue.
|
|
250
|
-
providePlugin(window, 'splitTracker', SplitTracker, log, sdkOptions.autoRequire);
|
|
252
|
+
providePlugin(window, 'splitTracker', SplitTracker, log, sdkOptions.autoRequire === true);
|
|
251
253
|
}
|
|
252
254
|
exports.GaToSplit = GaToSplit;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GoogleAnalyticsToSplit = void 0;
|
|
4
4
|
var GaToSplit_1 = require("./GaToSplit");
|
|
5
5
|
function GoogleAnalyticsToSplit(options) {
|
|
6
|
+
if (options === void 0) { options = {}; }
|
|
6
7
|
// GaToSplit integration factory
|
|
7
8
|
function GoogleAnalyticsToSplitFactory(params) {
|
|
8
9
|
return (0, GaToSplit_1.GaToSplit)(options, params);
|
|
@@ -61,7 +61,9 @@ function mapperBuilder(mapping) {
|
|
|
61
61
|
var fields = mapping.eventProperties[hitType];
|
|
62
62
|
if (fields) {
|
|
63
63
|
for (var i = 0; i < fields.length; i++) {
|
|
64
|
-
|
|
64
|
+
var fieldValue = model.get(fields[i]);
|
|
65
|
+
if (fieldValue !== undefined)
|
|
66
|
+
properties[fields[i]] = fieldValue;
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
return {
|
|
@@ -241,5 +243,5 @@ export function GaToSplit(sdkOptions, params) {
|
|
|
241
243
|
return SplitTracker;
|
|
242
244
|
}());
|
|
243
245
|
// Register the plugin, even if config is invalid, since, if not provided, it will block `ga` command queue.
|
|
244
|
-
providePlugin(window, 'splitTracker', SplitTracker, log, sdkOptions.autoRequire);
|
|
246
|
+
providePlugin(window, 'splitTracker', SplitTracker, log, sdkOptions.autoRequire === true);
|
|
245
247
|
}
|
package/package.json
CHANGED
|
@@ -78,7 +78,8 @@ function mapperBuilder(mapping: typeof defaultMapping) {
|
|
|
78
78
|
const fields: string[] = mapping.eventProperties[hitType];
|
|
79
79
|
if (fields) {
|
|
80
80
|
for (let i = 0; i < fields.length; i++) {
|
|
81
|
-
|
|
81
|
+
const fieldValue = model.get(fields[i]);
|
|
82
|
+
if (fieldValue !== undefined) properties[fields[i]] = fieldValue;
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
|
|
@@ -290,5 +291,5 @@ export function GaToSplit(sdkOptions: GoogleAnalyticsToSplitOptions, params: IIn
|
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
// Register the plugin, even if config is invalid, since, if not provided, it will block `ga` command queue.
|
|
293
|
-
providePlugin(window, 'splitTracker', SplitTracker, log, sdkOptions.autoRequire);
|
|
294
|
+
providePlugin(window, 'splitTracker', SplitTracker, log, sdkOptions.autoRequire === true);
|
|
294
295
|
}
|
|
@@ -2,7 +2,7 @@ import { IIntegrationFactoryParams, IntegrationFactory } from '../types';
|
|
|
2
2
|
import { GaToSplit } from './GaToSplit';
|
|
3
3
|
import { GoogleAnalyticsToSplitOptions } from './types';
|
|
4
4
|
|
|
5
|
-
export function GoogleAnalyticsToSplit(options: GoogleAnalyticsToSplitOptions): IntegrationFactory {
|
|
5
|
+
export function GoogleAnalyticsToSplit(options: GoogleAnalyticsToSplitOptions = {}): IntegrationFactory {
|
|
6
6
|
|
|
7
7
|
// GaToSplit integration factory
|
|
8
8
|
function GoogleAnalyticsToSplitFactory(params: IIntegrationFactoryParams) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IntegrationFactory } from '../types';
|
|
2
2
|
import { GoogleAnalyticsToSplitOptions } from './types';
|
|
3
|
-
export declare function GoogleAnalyticsToSplit(options
|
|
3
|
+
export declare function GoogleAnalyticsToSplit(options?: GoogleAnalyticsToSplitOptions): IntegrationFactory;
|