@funnelsgrove/runtime 0.7.12 → 0.7.13
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.
|
@@ -28,7 +28,25 @@ const EVENT_ATTRIBUTION_FILTER_KEYS = new Set([
|
|
|
28
28
|
'utm_campaign',
|
|
29
29
|
'utm_content',
|
|
30
30
|
'utm_term',
|
|
31
|
+
'utm_id',
|
|
32
|
+
'utm_ad',
|
|
33
|
+
'utm_adset',
|
|
34
|
+
'campaign_id',
|
|
35
|
+
'campaign_name',
|
|
36
|
+
'facebook_campaign_id',
|
|
31
37
|
'adset_id',
|
|
38
|
+
'adset_name',
|
|
39
|
+
'ad_set_id',
|
|
40
|
+
'facebook_adset_id',
|
|
41
|
+
'ad_id',
|
|
42
|
+
'ad_name',
|
|
43
|
+
'facebook_ad_id',
|
|
44
|
+
'creative_id',
|
|
45
|
+
'creative_name',
|
|
46
|
+
'facebook_creative_id',
|
|
47
|
+
'placement',
|
|
48
|
+
'site_source_name',
|
|
49
|
+
'media_source',
|
|
32
50
|
]);
|
|
33
51
|
const MAX_EVENT_ATTRIBUTION_FILTER_VALUE_CODE_POINTS = 256;
|
|
34
52
|
const POSTHOG_CONTEXT_MAPPINGS = {
|
|
@@ -257,7 +275,7 @@ export const mergeFunnelUserAttribution = (current, incoming) => {
|
|
|
257
275
|
context: deepMergeRecords(currentContext, nextContext),
|
|
258
276
|
};
|
|
259
277
|
};
|
|
260
|
-
export const buildFunnelAttributionEventMetadata = (attribution) => normalizeEventAttributionTouch(attribution === null || attribution === void 0 ? void 0 : attribution.
|
|
278
|
+
export const buildFunnelAttributionEventMetadata = (attribution) => normalizeEventAttributionTouch(attribution === null || attribution === void 0 ? void 0 : attribution.lastTouch);
|
|
261
279
|
export const getFunnelUserAttribution = (document) => {
|
|
262
280
|
if (!isRecord(document) || !isRecord(document.attribution)) {
|
|
263
281
|
return null;
|
|
@@ -8,7 +8,7 @@ import { buildHostedStepLocation, dispatchFunnelLocationChange, dispatchWindowCu
|
|
|
8
8
|
import { isPreviewStepLockRequested, resolveNextStepFromContext, shouldRunAutoAdvanceTimer, } from './funnel-flow.js';
|
|
9
9
|
import { usePreviewBridge } from './preview-bridge.js';
|
|
10
10
|
import { resolveExperimentAssignment, resolveForcedExperimentAssignment, } from './experiment-assignment.js';
|
|
11
|
-
import { buildFunnelAttributionEventMetadata, collectCurrentFunnelAttribution, getFunnelUserAttribution, } from './funnel-attribution.js';
|
|
11
|
+
import { buildFunnelAttributionEventMetadata, collectCurrentFunnelAttribution, getFunnelUserAttribution, mergeFunnelUserAttribution, } from './funnel-attribution.js';
|
|
12
12
|
import { resolveUrlUserAttributes } from './url-user-attributes.js';
|
|
13
13
|
import { bootstrapPostHog, identifyPostHog, isPostHogReady, resolveExperimentVariant, } from './posthog-flags.js';
|
|
14
14
|
import { getRuntimeMode, isEditorEnabled, useRuntimeMode } from '../services/runtime-mode.service.js';
|
|
@@ -24,8 +24,17 @@ const isTerminalCompletion = (stepMeta, outcome) => {
|
|
|
24
24
|
&& Boolean(stepMeta && ((_a = FUNNEL_STEP_CONTRACTS[stepMeta.type]) === null || _a === void 0 ? void 0 : _a.terminal) === true));
|
|
25
25
|
};
|
|
26
26
|
export function resolveFunnelEventAttribution(document, provisionalAttribution) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const persistedAttribution = getFunnelUserAttribution(document);
|
|
28
|
+
if (!persistedAttribution) {
|
|
29
|
+
return provisionalAttribution;
|
|
30
|
+
}
|
|
31
|
+
if (!provisionalAttribution) {
|
|
32
|
+
return persistedAttribution;
|
|
33
|
+
}
|
|
34
|
+
return Object.assign(Object.assign({}, mergeFunnelUserAttribution(persistedAttribution, provisionalAttribution)), {
|
|
35
|
+
// This event describes the page load happening now. An empty current URL is
|
|
36
|
+
// intentionally direct; never revive a paid click from an older visit.
|
|
37
|
+
lastTouch: Object.assign({}, provisionalAttribution.lastTouch) });
|
|
29
38
|
}
|
|
30
39
|
export function buildReadyFunnelAttributionEventMetadata(attributionReady, attribution) {
|
|
31
40
|
return attributionReady ? buildFunnelAttributionEventMetadata(attribution) : null;
|