@ninetailed/experience.js-plugin-google-analytics 4.2.0-beta.2 → 4.2.0-beta.4
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/NinetailedGoogleAnalyticsPlugin.d.ts +1 -2
- package/index.cjs +6 -11
- package/index.js +6 -7
- package/package.json +4 -4
|
@@ -5,9 +5,8 @@ type NinetailedGoogleAnalyticsPluginOptions = {
|
|
|
5
5
|
labelTemplate?: string;
|
|
6
6
|
};
|
|
7
7
|
export declare class NinetailedGoogleAnalyticsPlugin extends NinetailedAnalyticsPlugin {
|
|
8
|
+
private options;
|
|
8
9
|
name: string;
|
|
9
|
-
private readonly actionTemplate;
|
|
10
|
-
private readonly labelTemplate;
|
|
11
10
|
constructor(options?: NinetailedGoogleAnalyticsPluginOptions);
|
|
12
11
|
protected onTrackExperience(properties: TrackExperienceProperties): Promise<void>;
|
|
13
12
|
protected onTrackComponent(properties: TrackComponentProperties): Promise<void>;
|
package/index.cjs
CHANGED
|
@@ -2,12 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var template = require('lodash/template');
|
|
6
5
|
var experience_jsPluginAnalytics = require('@ninetailed/experience.js-plugin-analytics');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var template__default = /*#__PURE__*/_interopDefaultLegacy(template);
|
|
6
|
+
var experience_jsShared = require('@ninetailed/experience.js-shared');
|
|
11
7
|
|
|
12
8
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
13
9
|
|
|
@@ -2246,9 +2242,8 @@ const isGoogleAnalyticsInitialized = () => {
|
|
|
2246
2242
|
class NinetailedGoogleAnalyticsPlugin extends experience_jsPluginAnalytics.NinetailedAnalyticsPlugin {
|
|
2247
2243
|
constructor(options = {}) {
|
|
2248
2244
|
super();
|
|
2245
|
+
this.options = options;
|
|
2249
2246
|
this.name = 'ninetailed:google-analytics';
|
|
2250
|
-
this.actionTemplate = template__default["default"](options.actionTemplate || 'Has Seen Component - Audience:{{ audience.id }}', TEMPLATE_OPTIONS);
|
|
2251
|
-
this.labelTemplate = template__default["default"](options.labelTemplate || '{{ baselineOrVariant }}:{{ component.id }}', TEMPLATE_OPTIONS);
|
|
2252
2247
|
}
|
|
2253
2248
|
onTrackExperience(properties) {
|
|
2254
2249
|
return Promise.resolve();
|
|
@@ -2263,15 +2258,15 @@ class NinetailedGoogleAnalyticsPlugin extends experience_jsPluginAnalytics.Ninet
|
|
|
2263
2258
|
audience,
|
|
2264
2259
|
isPersonalized
|
|
2265
2260
|
} = properties;
|
|
2266
|
-
const action = this.actionTemplate
|
|
2261
|
+
const action = experience_jsShared.template(this.options.actionTemplate || 'Has Seen Component - Audience:{{ audience.id }}', {
|
|
2267
2262
|
component: variant,
|
|
2268
2263
|
audience
|
|
2269
|
-
});
|
|
2270
|
-
const label = this.labelTemplate
|
|
2264
|
+
}, TEMPLATE_OPTIONS.interpolate);
|
|
2265
|
+
const label = experience_jsShared.template(this.options.labelTemplate || '{{ baselineOrVariant }}:{{ component.id }}', {
|
|
2271
2266
|
component: variant,
|
|
2272
2267
|
audience,
|
|
2273
2268
|
baselineOrVariant: isPersonalized ? 'Variant' : 'Baseline'
|
|
2274
|
-
});
|
|
2269
|
+
}, TEMPLATE_OPTIONS.interpolate);
|
|
2275
2270
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2276
2271
|
// @ts-ignore
|
|
2277
2272
|
window.gtag('event', action, {
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import template from 'lodash/template';
|
|
2
1
|
import { NinetailedAnalyticsPlugin } from '@ninetailed/experience.js-plugin-analytics';
|
|
2
|
+
import { template } from '@ninetailed/experience.js-shared';
|
|
3
3
|
|
|
4
4
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
5
5
|
|
|
@@ -2238,9 +2238,8 @@ const isGoogleAnalyticsInitialized = () => {
|
|
|
2238
2238
|
class NinetailedGoogleAnalyticsPlugin extends NinetailedAnalyticsPlugin {
|
|
2239
2239
|
constructor(options = {}) {
|
|
2240
2240
|
super();
|
|
2241
|
+
this.options = options;
|
|
2241
2242
|
this.name = 'ninetailed:google-analytics';
|
|
2242
|
-
this.actionTemplate = template(options.actionTemplate || 'Has Seen Component - Audience:{{ audience.id }}', TEMPLATE_OPTIONS);
|
|
2243
|
-
this.labelTemplate = template(options.labelTemplate || '{{ baselineOrVariant }}:{{ component.id }}', TEMPLATE_OPTIONS);
|
|
2244
2243
|
}
|
|
2245
2244
|
onTrackExperience(properties) {
|
|
2246
2245
|
return Promise.resolve();
|
|
@@ -2255,15 +2254,15 @@ class NinetailedGoogleAnalyticsPlugin extends NinetailedAnalyticsPlugin {
|
|
|
2255
2254
|
audience,
|
|
2256
2255
|
isPersonalized
|
|
2257
2256
|
} = properties;
|
|
2258
|
-
const action = this.actionTemplate
|
|
2257
|
+
const action = template(this.options.actionTemplate || 'Has Seen Component - Audience:{{ audience.id }}', {
|
|
2259
2258
|
component: variant,
|
|
2260
2259
|
audience
|
|
2261
|
-
});
|
|
2262
|
-
const label = this.labelTemplate
|
|
2260
|
+
}, TEMPLATE_OPTIONS.interpolate);
|
|
2261
|
+
const label = template(this.options.labelTemplate || '{{ baselineOrVariant }}:{{ component.id }}', {
|
|
2263
2262
|
component: variant,
|
|
2264
2263
|
audience,
|
|
2265
2264
|
baselineOrVariant: isPersonalized ? 'Variant' : 'Baseline'
|
|
2266
|
-
});
|
|
2265
|
+
}, TEMPLATE_OPTIONS.interpolate);
|
|
2267
2266
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2268
2267
|
// @ts-ignore
|
|
2269
2268
|
window.gtag('event', action, {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js-plugin-google-analytics",
|
|
3
|
-
"version": "4.2.0-beta.
|
|
3
|
+
"version": "4.2.0-beta.4",
|
|
4
4
|
"module": "./index.js",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@ninetailed/experience.js": "4.2.0-beta.
|
|
10
|
-
"@ninetailed/experience.js-plugin-analytics": "4.2.0-beta.
|
|
11
|
-
"
|
|
9
|
+
"@ninetailed/experience.js": "4.2.0-beta.4",
|
|
10
|
+
"@ninetailed/experience.js-plugin-analytics": "4.2.0-beta.4",
|
|
11
|
+
"@ninetailed/experience.js-shared": "4.2.0-beta.4"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {}
|
|
14
14
|
}
|