@aranova/tracking-react 0.17.1 → 0.17.2
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/index.js +65 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -42
- package/dist/index.mjs.map +1 -1
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1134,6 +1134,27 @@ function getOrCreateTrackingClient(config) {
|
|
|
1134
1134
|
globalClientKey = key;
|
|
1135
1135
|
return globalClient;
|
|
1136
1136
|
}
|
|
1137
|
+
var clientCaptureRegistry = /* @__PURE__ */ new WeakMap();
|
|
1138
|
+
function attachClientCapturesOnce(client, build) {
|
|
1139
|
+
let entry = clientCaptureRegistry.get(client);
|
|
1140
|
+
if (entry === void 0) {
|
|
1141
|
+
entry = { detach: build(), refCount: 0 };
|
|
1142
|
+
clientCaptureRegistry.set(client, entry);
|
|
1143
|
+
}
|
|
1144
|
+
entry.refCount += 1;
|
|
1145
|
+
let released = false;
|
|
1146
|
+
return () => {
|
|
1147
|
+
if (released) return;
|
|
1148
|
+
released = true;
|
|
1149
|
+
const current = clientCaptureRegistry.get(client);
|
|
1150
|
+
if (current === void 0) return;
|
|
1151
|
+
current.refCount -= 1;
|
|
1152
|
+
if (current.refCount <= 0) {
|
|
1153
|
+
current.detach();
|
|
1154
|
+
clientCaptureRegistry.delete(client);
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1137
1158
|
function createTrackingClient(config) {
|
|
1138
1159
|
const flushIntervalMs = config.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;
|
|
1139
1160
|
const maxQueueSize = Math.min(config.maxQueueSize ?? DEFAULT_MAX_QUEUE_SIZE, HARD_MAX_BATCH);
|
|
@@ -2800,7 +2821,7 @@ function GoogleAdsTracking(props) {
|
|
|
2800
2821
|
import { createContext as createContext2, useContext as useContext2, useEffect as useEffect5, useMemo as useMemo4 } from "react";
|
|
2801
2822
|
|
|
2802
2823
|
// package.json
|
|
2803
|
-
var version = "0.17.
|
|
2824
|
+
var version = "0.17.2";
|
|
2804
2825
|
|
|
2805
2826
|
// ../tracking-core/src/phone-react.tsx
|
|
2806
2827
|
import {
|
|
@@ -2970,7 +2991,6 @@ function createTracking(options) {
|
|
|
2970
2991
|
}
|
|
2971
2992
|
}, [metaPixelId, metaPixelIdsKey]);
|
|
2972
2993
|
useEffect5(() => {
|
|
2973
|
-
const detachers = [];
|
|
2974
2994
|
const rawClient = getOrCreateTrackingClient({
|
|
2975
2995
|
apiKey,
|
|
2976
2996
|
endpoint,
|
|
@@ -2981,47 +3001,50 @@ function createTracking(options) {
|
|
|
2981
3001
|
activeGtagIds: resolvedGtagIds,
|
|
2982
3002
|
debug
|
|
2983
3003
|
});
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
if (ctaClick) {
|
|
3014
|
-
detachers.push(attachCtaClickCapture(detectorClient, ctaClick));
|
|
3015
|
-
}
|
|
3016
|
-
const phoneClick = triggers.manual?.phone_click;
|
|
3017
|
-
if (phoneClick) {
|
|
3018
|
-
detachers.push(attachPhoneClickCapture(detectorClient, phoneClick));
|
|
3019
|
-
}
|
|
3020
|
-
return () => {
|
|
3021
|
-
for (let i = detachers.length - 1; i >= 0; i--) {
|
|
3022
|
-
detachers[i]();
|
|
3004
|
+
return attachClientCapturesOnce(rawClient, () => {
|
|
3005
|
+
const detachers = [];
|
|
3006
|
+
const conversionStore = conversionConfig ? resolveConversionConfig({
|
|
3007
|
+
cdnUrl: conversionConfig.cdnUrl,
|
|
3008
|
+
baked: conversionConfig.baked
|
|
3009
|
+
}) : null;
|
|
3010
|
+
const detectorClient = conversionStore ? withConversionAutoFire(rawClient, createConversionAutoFire(conversionStore)) : rawClient;
|
|
3011
|
+
detachers.push(attachAutoPageView(detectorClient));
|
|
3012
|
+
detachers.push(attachBfcacheRestore(detectorClient));
|
|
3013
|
+
detachers.push(attachPageExit(detectorClient));
|
|
3014
|
+
const timeOnSite = triggers.automatic.time_on_site;
|
|
3015
|
+
if (timeOnSite) {
|
|
3016
|
+
detachers.push(attachTimeOnSite(detectorClient, timeOnSite));
|
|
3017
|
+
}
|
|
3018
|
+
const specificPageVisit = triggers.automatic.specific_page_visit;
|
|
3019
|
+
if (specificPageVisit) {
|
|
3020
|
+
detachers.push(attachSpecificPageVisit(detectorClient, specificPageVisit));
|
|
3021
|
+
}
|
|
3022
|
+
const scrollDepth = triggers.automatic.scroll_depth;
|
|
3023
|
+
if (scrollDepth) {
|
|
3024
|
+
detachers.push(attachScrollDepth(detectorClient, scrollDepth));
|
|
3025
|
+
}
|
|
3026
|
+
const multiPageSession = triggers.automatic.multi_page_session;
|
|
3027
|
+
if (multiPageSession) {
|
|
3028
|
+
detachers.push(attachMultiPageSession(detectorClient, multiPageSession));
|
|
3029
|
+
}
|
|
3030
|
+
const formStart = triggers.automatic.form_start;
|
|
3031
|
+
if (formStart) {
|
|
3032
|
+
detachers.push(attachFormStart(detectorClient, formStart));
|
|
3023
3033
|
}
|
|
3024
|
-
|
|
3034
|
+
const ctaClick = triggers.manual?.cta_click;
|
|
3035
|
+
if (ctaClick) {
|
|
3036
|
+
detachers.push(attachCtaClickCapture(detectorClient, ctaClick));
|
|
3037
|
+
}
|
|
3038
|
+
const phoneClick = triggers.manual?.phone_click;
|
|
3039
|
+
if (phoneClick) {
|
|
3040
|
+
detachers.push(attachPhoneClickCapture(detectorClient, phoneClick));
|
|
3041
|
+
}
|
|
3042
|
+
return () => {
|
|
3043
|
+
for (let i = detachers.length - 1; i >= 0; i--) {
|
|
3044
|
+
detachers[i]();
|
|
3045
|
+
}
|
|
3046
|
+
};
|
|
3047
|
+
});
|
|
3025
3048
|
}, []);
|
|
3026
3049
|
return /* @__PURE__ */ jsx3(TrackingContext.Provider, { value: client, children: /* @__PURE__ */ jsx3(PhoneConfigProvider, { value: phone ?? null, children }) });
|
|
3027
3050
|
}
|