@anker-in/analysis 0.1.0 → 0.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/index.cjs +827 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +489 -0
- package/dist/index.d.ts +474 -21
- package/dist/index.js +771 -33
- package/dist/index.js.map +1 -0
- package/package.json +23 -36
- package/dist/autoTrack/click.d.ts +0 -2
- package/dist/autoTrack/click.d.ts.map +0 -1
- package/dist/autoTrack/click.js +0 -80
- package/dist/autoTrack/index.d.ts +0 -2
- package/dist/autoTrack/index.d.ts.map +0 -1
- package/dist/autoTrack/index.js +0 -47
- package/dist/autoTrack/pv.d.ts +0 -2
- package/dist/autoTrack/pv.d.ts.map +0 -1
- package/dist/autoTrack/pv.js +0 -57
- package/dist/autoTrack/trackByTags.d.ts +0 -17
- package/dist/autoTrack/trackByTags.d.ts.map +0 -1
- package/dist/autoTrack/trackByTags.js +0 -141
- package/dist/constants/index.d.ts +0 -2
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/index.js +0 -1
- package/dist/constants/tagsMap.d.ts +0 -9
- package/dist/constants/tagsMap.d.ts.map +0 -1
- package/dist/constants/tagsMap.js +0 -8
- package/dist/core/adapters/gtag.d.ts +0 -37
- package/dist/core/adapters/gtag.d.ts.map +0 -1
- package/dist/core/adapters/gtag.js +0 -55
- package/dist/core/adapters/index.d.ts +0 -6
- package/dist/core/adapters/index.d.ts.map +0 -1
- package/dist/core/adapters/index.js +0 -5
- package/dist/core/adapters/meta.d.ts +0 -20
- package/dist/core/adapters/meta.d.ts.map +0 -1
- package/dist/core/adapters/meta.js +0 -41
- package/dist/core/helpers/function-utils.d.ts +0 -17
- package/dist/core/helpers/function-utils.d.ts.map +0 -1
- package/dist/core/helpers/function-utils.js +0 -43
- package/dist/core/helpers/index.d.ts +0 -8
- package/dist/core/helpers/index.d.ts.map +0 -1
- package/dist/core/helpers/index.js +0 -7
- package/dist/core/helpers/logger.d.ts +0 -20
- package/dist/core/helpers/logger.d.ts.map +0 -1
- package/dist/core/helpers/logger.js +0 -32
- package/dist/core/helpers/platform-detector.d.ts +0 -14
- package/dist/core/helpers/platform-detector.d.ts.map +0 -1
- package/dist/core/helpers/platform-detector.js +0 -28
- package/dist/core/helpers/script-loader.d.ts +0 -39
- package/dist/core/helpers/script-loader.d.ts.map +0 -1
- package/dist/core/helpers/script-loader.js +0 -107
- package/dist/core/index.d.ts +0 -7
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -9
- package/dist/core/track/gtagTrack.d.ts +0 -2
- package/dist/core/track/gtagTrack.d.ts.map +0 -1
- package/dist/core/track/gtagTrack.js +0 -12
- package/dist/core/track/index.d.ts +0 -4
- package/dist/core/track/index.d.ts.map +0 -1
- package/dist/core/track/index.js +0 -3
- package/dist/core/track/metaTrack.d.ts +0 -2
- package/dist/core/track/metaTrack.d.ts.map +0 -1
- package/dist/core/track/metaTrack.js +0 -18
- package/dist/core/track/track.d.ts +0 -6
- package/dist/core/track/track.d.ts.map +0 -1
- package/dist/core/track/track.js +0 -128
- package/dist/core/tracking/dispatcher.d.ts +0 -10
- package/dist/core/tracking/dispatcher.d.ts.map +0 -1
- package/dist/core/tracking/dispatcher.js +0 -67
- package/dist/core/tracking/index.d.ts +0 -6
- package/dist/core/tracking/index.d.ts.map +0 -1
- package/dist/core/tracking/index.js +0 -5
- package/dist/core/tracking/with-tracking.d.ts +0 -33
- package/dist/core/tracking/with-tracking.d.ts.map +0 -1
- package/dist/core/tracking/with-tracking.js +0 -137
- package/dist/core/utils.d.ts +0 -64
- package/dist/core/utils.d.ts.map +0 -1
- package/dist/core/utils.js +0 -182
- package/dist/index.d.ts.map +0 -1
- package/dist/pixels/GtagPixel.d.ts +0 -7
- package/dist/pixels/GtagPixel.d.ts.map +0 -1
- package/dist/pixels/GtagPixel.js +0 -73
- package/dist/pixels/MetaPixel.d.ts +0 -7
- package/dist/pixels/MetaPixel.d.ts.map +0 -1
- package/dist/pixels/MetaPixel.js +0 -61
- package/dist/pixels/PixelsManager.d.ts +0 -5
- package/dist/pixels/PixelsManager.d.ts.map +0 -1
- package/dist/pixels/PixelsManager.js +0 -17
- package/dist/pixels/index.d.ts +0 -4
- package/dist/pixels/index.d.ts.map +0 -1
- package/dist/pixels/index.js +0 -3
- package/dist/types/common.d.ts +0 -66
- package/dist/types/common.d.ts.map +0 -1
- package/dist/types/common.js +0 -1
- package/dist/types/gtag.d.ts +0 -34
- package/dist/types/gtag.d.ts.map +0 -1
- package/dist/types/gtag.js +0 -1
- package/dist/types/index.d.ts +0 -91
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/meta.d.ts +0 -8
- package/dist/types/meta.d.ts.map +0 -1
- package/dist/types/meta.js +0 -4
- package/dist/types/trackByTags.d.ts +0 -26
- package/dist/types/trackByTags.d.ts.map +0 -1
- package/dist/types/trackByTags.js +0 -4
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,827 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
32
|
+
var index_exports = {};
|
|
33
|
+
__export(index_exports, {
|
|
34
|
+
GtagPixel: () => GtagPixel_default,
|
|
35
|
+
MetaPixel: () => MetaPixel_default,
|
|
36
|
+
PixelsManager: () => PixelsManager_default,
|
|
37
|
+
TrackTagsVersionMap: () => TrackTagsVersionMap,
|
|
38
|
+
clearTrackTags: () => clearTrackTags,
|
|
39
|
+
default: () => index_default,
|
|
40
|
+
gtagTrack: () => gtagTrack,
|
|
41
|
+
hasTrackPoint: () => hasTrackPoint,
|
|
42
|
+
isPlatformAvailable: () => isPlatformAvailable,
|
|
43
|
+
logger: () => logger,
|
|
44
|
+
metaTrack: () => metaTrack,
|
|
45
|
+
setTrackTags: () => setTrackTags,
|
|
46
|
+
track: () => track,
|
|
47
|
+
trackByTags: () => trackByTags,
|
|
48
|
+
triggerTrack: () => triggerTrack,
|
|
49
|
+
triggerTrackBatch: () => triggerTrackBatch,
|
|
50
|
+
updateScriptType: () => updateScriptType,
|
|
51
|
+
updateScriptsType: () => updateScriptsType,
|
|
52
|
+
useTracking: () => useTracking,
|
|
53
|
+
withTracking: () => withTracking
|
|
54
|
+
});
|
|
55
|
+
module.exports = __toCommonJS(index_exports);
|
|
56
|
+
|
|
57
|
+
// src/core/helpers/logger.ts
|
|
58
|
+
function createLogger(initialEnabled = false) {
|
|
59
|
+
let enabled = initialEnabled;
|
|
60
|
+
return {
|
|
61
|
+
setEnabled(value) {
|
|
62
|
+
enabled = value;
|
|
63
|
+
},
|
|
64
|
+
log(...args) {
|
|
65
|
+
if (enabled) {
|
|
66
|
+
console.log("[Analysis SDK]", ...args);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
warn(...args) {
|
|
70
|
+
if (enabled) {
|
|
71
|
+
console.warn("[Analysis SDK]", ...args);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
error(...args) {
|
|
75
|
+
if (enabled) {
|
|
76
|
+
console.error("[Analysis SDK]", ...args);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
__name(createLogger, "createLogger");
|
|
82
|
+
var logger = createLogger();
|
|
83
|
+
|
|
84
|
+
// src/core/helpers/script-loader.ts
|
|
85
|
+
function updateScriptType(options) {
|
|
86
|
+
const { id, enabled, executeOnEnable = true, onError } = options;
|
|
87
|
+
if (typeof window === "undefined") {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
const scriptElement = document.getElementById(id);
|
|
91
|
+
if (!scriptElement) {
|
|
92
|
+
logger.warn(`Script element with id "${id}" not found`);
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const newType = enabled ? "text/javascript" : "text/plain";
|
|
96
|
+
const currentType = scriptElement.getAttribute("type");
|
|
97
|
+
if (executeOnEnable && currentType === "text/plain" && newType === "text/javascript") {
|
|
98
|
+
scriptElement.setAttribute("type", newType);
|
|
99
|
+
const scriptContent = scriptElement.innerHTML;
|
|
100
|
+
if (scriptContent && typeof window.eval === "function") {
|
|
101
|
+
try {
|
|
102
|
+
window.eval(scriptContent);
|
|
103
|
+
logger.log(`Script "${id}" executed successfully`);
|
|
104
|
+
} catch (e) {
|
|
105
|
+
const error = e instanceof Error ? e : new Error(String(e));
|
|
106
|
+
logger.error(`Script "${id}" execution error:`, error);
|
|
107
|
+
if (onError) {
|
|
108
|
+
onError(error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
scriptElement.setAttribute("type", newType);
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
__name(updateScriptType, "updateScriptType");
|
|
118
|
+
function updateScriptsType(scriptIds, enabled, executeOnEnable = true) {
|
|
119
|
+
if (typeof window === "undefined") {
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
let successCount = 0;
|
|
123
|
+
const ids = Array.isArray(scriptIds) ? scriptIds : Array.from({ length: 100 }, (_, i) => scriptIds(i)).filter(
|
|
124
|
+
(id) => document.getElementById(id)
|
|
125
|
+
);
|
|
126
|
+
ids.forEach((id) => {
|
|
127
|
+
const success = updateScriptType({
|
|
128
|
+
id,
|
|
129
|
+
enabled,
|
|
130
|
+
executeOnEnable
|
|
131
|
+
});
|
|
132
|
+
if (success) {
|
|
133
|
+
successCount++;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
logger.log(`Updated ${successCount}/${ids.length} scripts`);
|
|
137
|
+
return successCount;
|
|
138
|
+
}
|
|
139
|
+
__name(updateScriptsType, "updateScriptsType");
|
|
140
|
+
|
|
141
|
+
// src/core/helpers/function-utils.ts
|
|
142
|
+
function debounce(fn, delay) {
|
|
143
|
+
let timer = null;
|
|
144
|
+
return function(...args) {
|
|
145
|
+
if (timer) clearTimeout(timer);
|
|
146
|
+
timer = setTimeout(() => {
|
|
147
|
+
fn.apply(this, args);
|
|
148
|
+
}, delay);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
__name(debounce, "debounce");
|
|
152
|
+
function throttle(fn, delay) {
|
|
153
|
+
let lastTime = 0;
|
|
154
|
+
return function(...args) {
|
|
155
|
+
const now = Date.now();
|
|
156
|
+
if (now - lastTime >= delay) {
|
|
157
|
+
lastTime = now;
|
|
158
|
+
fn.apply(this, args);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
__name(throttle, "throttle");
|
|
163
|
+
|
|
164
|
+
// src/core/helpers/platform-detector.ts
|
|
165
|
+
var isPlatformAvailable = /* @__PURE__ */ __name((platform) => {
|
|
166
|
+
if (typeof window === "undefined") {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
switch (platform) {
|
|
170
|
+
case "gtag":
|
|
171
|
+
return typeof window.gtag !== "undefined" || typeof window.dataLayer !== "undefined";
|
|
172
|
+
case "meta":
|
|
173
|
+
return typeof window.fbq !== "undefined";
|
|
174
|
+
default:
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
}, "isPlatformAvailable");
|
|
178
|
+
|
|
179
|
+
// src/constants/tagsMap.ts
|
|
180
|
+
var TrackTagsVersionMap = {
|
|
181
|
+
"fbq:act": "fbq:atc",
|
|
182
|
+
"gtag:conversion": "gtag:atc"
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// src/autoTrack/trackByTags.ts
|
|
186
|
+
function parseTag(tag) {
|
|
187
|
+
const parts = tag.split(":");
|
|
188
|
+
if (parts.length < 2) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
media: parts[0]?.toLowerCase() || "",
|
|
193
|
+
event: parts[1]?.toLowerCase() || "",
|
|
194
|
+
target: parts[2] || null
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
__name(parseTag, "parseTag");
|
|
198
|
+
function adaptEventName(tags) {
|
|
199
|
+
for (let i = 0; i < tags.length; i++) {
|
|
200
|
+
if (!tags[i]) {
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
for (const [oldEvent, newEvent] of Object.entries(TrackTagsVersionMap)) {
|
|
204
|
+
if (tags[i]?.includes(oldEvent)) {
|
|
205
|
+
tags[i] = tags[i]?.replace(oldEvent, newEvent) ?? "";
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
__name(adaptEventName, "adaptEventName");
|
|
212
|
+
function handleTagTracking(parsedTag, eventData) {
|
|
213
|
+
const { media, event, target } = parsedTag;
|
|
214
|
+
if (!target) {
|
|
215
|
+
logger.warn(`Tag missing target: ${media}:${event}`);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
switch (media) {
|
|
220
|
+
case "fbq":
|
|
221
|
+
case "meta": {
|
|
222
|
+
const config = {
|
|
223
|
+
platform: "meta",
|
|
224
|
+
event: target,
|
|
225
|
+
// target 作为事件名
|
|
226
|
+
data: eventData
|
|
227
|
+
};
|
|
228
|
+
track(config);
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
case "gtag": {
|
|
232
|
+
const config = {
|
|
233
|
+
platform: "gtag",
|
|
234
|
+
eventName: "conversion",
|
|
235
|
+
send_to: target,
|
|
236
|
+
// target 作为转化目标ID
|
|
237
|
+
value: eventData?.value ?? 1,
|
|
238
|
+
currency: eventData?.currency,
|
|
239
|
+
transactionId: eventData?.transactionId
|
|
240
|
+
};
|
|
241
|
+
track(config);
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
default:
|
|
245
|
+
logger.warn(`Unsupported media platform: ${media}`);
|
|
246
|
+
}
|
|
247
|
+
} catch (error) {
|
|
248
|
+
logger.error(`Failed to track tag ${media}:${event}:${target}:`, error);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
__name(handleTagTracking, "handleTagTracking");
|
|
252
|
+
function trackByTags({ tags, data }) {
|
|
253
|
+
if (!tags || tags.length === 0) {
|
|
254
|
+
logger.warn("trackByTags: tags array is empty");
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const adaptedTags = [...tags];
|
|
258
|
+
adaptEventName(adaptedTags);
|
|
259
|
+
const firstData = data && data.length > 0 ? data[0] : void 0;
|
|
260
|
+
const { event, ...trackingData } = firstData || {};
|
|
261
|
+
adaptedTags.forEach((tag) => {
|
|
262
|
+
const parsed = parseTag(tag);
|
|
263
|
+
if (!parsed) {
|
|
264
|
+
logger.warn(`trackByTags: Invalid tag format: ${tag}`);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
handleTagTracking(parsed, trackingData);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
__name(trackByTags, "trackByTags");
|
|
271
|
+
|
|
272
|
+
// src/core/helpers/triggerTrack.ts
|
|
273
|
+
function getTrackTagsFromStorage(storageKey) {
|
|
274
|
+
if (typeof window === "undefined" || !window.sessionStorage) {
|
|
275
|
+
logger.warn("sessionStorage is not available");
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
const trackTagsRaw = sessionStorage.getItem(storageKey);
|
|
280
|
+
if (!trackTagsRaw) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
const trackTags = JSON.parse(trackTagsRaw);
|
|
284
|
+
if (!trackTags || typeof trackTags !== "object") {
|
|
285
|
+
logger.warn(
|
|
286
|
+
`Invalid trackTags format in sessionStorage key: ${storageKey}`
|
|
287
|
+
);
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
return trackTags;
|
|
291
|
+
} catch (error) {
|
|
292
|
+
logger.error(`Failed to parse trackTags from sessionStorage:`, error);
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
__name(getTrackTagsFromStorage, "getTrackTagsFromStorage");
|
|
297
|
+
function triggerTrack(trackPoint, options = {}) {
|
|
298
|
+
const {
|
|
299
|
+
tags,
|
|
300
|
+
eventData = {},
|
|
301
|
+
storageKey = "trackTags",
|
|
302
|
+
silent = false
|
|
303
|
+
} = options;
|
|
304
|
+
if (!trackPoint || typeof trackPoint !== "string") {
|
|
305
|
+
if (!silent) {
|
|
306
|
+
logger.warn("triggerTrack: trackPoint is required and must be a string");
|
|
307
|
+
}
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const trackTagsRow = getTrackTagsFromStorage(storageKey);
|
|
311
|
+
if (!trackTagsRow) {
|
|
312
|
+
if (!silent) {
|
|
313
|
+
logger.warn(
|
|
314
|
+
`triggerTrack: trackTags not found in sessionStorage (key: ${storageKey})`
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
const trackTags = tags || trackTagsRow[trackPoint];
|
|
320
|
+
if (!trackTags) {
|
|
321
|
+
if (!silent) {
|
|
322
|
+
logger.warn(`triggerTrack: No tags found for trackPoint: ${trackPoint}`);
|
|
323
|
+
}
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (!Array.isArray(trackTags)) {
|
|
327
|
+
if (!silent) {
|
|
328
|
+
logger.warn(
|
|
329
|
+
`triggerTrack: Tags for trackPoint "${trackPoint}" is not an array`
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
if (trackTags.length === 0) {
|
|
335
|
+
if (!silent) {
|
|
336
|
+
logger.log(
|
|
337
|
+
`triggerTrack: Tags array is empty for trackPoint: ${trackPoint}`
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
try {
|
|
343
|
+
trackByTags({
|
|
344
|
+
tags: trackTags,
|
|
345
|
+
data: [{ event: "custom", ...eventData }]
|
|
346
|
+
});
|
|
347
|
+
logger.log(
|
|
348
|
+
`triggerTrack: Successfully triggered for trackPoint: ${trackPoint}`,
|
|
349
|
+
{
|
|
350
|
+
tagsCount: trackTags.length,
|
|
351
|
+
trackTags
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
} catch (error) {
|
|
355
|
+
logger.error(
|
|
356
|
+
`triggerTrack: Failed to track for trackPoint: ${trackPoint}`,
|
|
357
|
+
error
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
__name(triggerTrack, "triggerTrack");
|
|
362
|
+
function triggerTrackBatch(trackPoints, options = {}) {
|
|
363
|
+
if (!Array.isArray(trackPoints)) {
|
|
364
|
+
logger.warn("triggerTrackBatch: trackPoints must be an array");
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
trackPoints.forEach((trackPoint) => {
|
|
368
|
+
triggerTrack(trackPoint, options);
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
__name(triggerTrackBatch, "triggerTrackBatch");
|
|
372
|
+
function setTrackTags(trackTags, storageKey = "trackTags") {
|
|
373
|
+
if (typeof window === "undefined" || !window.sessionStorage) {
|
|
374
|
+
logger.warn("sessionStorage is not available");
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
try {
|
|
378
|
+
const trackTagsJson = JSON.stringify(trackTags);
|
|
379
|
+
sessionStorage.setItem(storageKey, trackTagsJson);
|
|
380
|
+
logger.log(
|
|
381
|
+
`setTrackTags: Successfully saved to sessionStorage (key: ${storageKey})`
|
|
382
|
+
);
|
|
383
|
+
} catch (error) {
|
|
384
|
+
logger.error("setTrackTags: Failed to save to sessionStorage", error);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
__name(setTrackTags, "setTrackTags");
|
|
388
|
+
function clearTrackTags(storageKey = "trackTags") {
|
|
389
|
+
if (typeof window === "undefined" || !window.sessionStorage) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
try {
|
|
393
|
+
sessionStorage.removeItem(storageKey);
|
|
394
|
+
logger.log(
|
|
395
|
+
`clearTrackTags: Successfully removed from sessionStorage (key: ${storageKey})`
|
|
396
|
+
);
|
|
397
|
+
} catch (error) {
|
|
398
|
+
logger.error("clearTrackTags: Failed to remove from sessionStorage", error);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
__name(clearTrackTags, "clearTrackTags");
|
|
402
|
+
function hasTrackPoint(trackPoint, storageKey = "trackTags") {
|
|
403
|
+
const trackTags = getTrackTagsFromStorage(storageKey);
|
|
404
|
+
if (!trackTags) {
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
const tags = trackTags[trackPoint];
|
|
408
|
+
return Array.isArray(tags) && tags.length > 0;
|
|
409
|
+
}
|
|
410
|
+
__name(hasTrackPoint, "hasTrackPoint");
|
|
411
|
+
|
|
412
|
+
// src/core/adapters/gtag.ts
|
|
413
|
+
var gtagTrack = /* @__PURE__ */ __name((command, targetOrEventName, params) => {
|
|
414
|
+
if (typeof window === "undefined") {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
if (typeof window.gtag !== "function") {
|
|
418
|
+
console.warn("gtag is not available. Please load gtag.js first.");
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
try {
|
|
422
|
+
window.gtag(command, targetOrEventName, params);
|
|
423
|
+
} catch (error) {
|
|
424
|
+
console.error("gtagTrack error:", error);
|
|
425
|
+
}
|
|
426
|
+
}, "gtagTrack");
|
|
427
|
+
var gtagEvent = /* @__PURE__ */ __name((eventName, eventParams) => {
|
|
428
|
+
gtagTrack("event", eventName, eventParams);
|
|
429
|
+
}, "gtagEvent");
|
|
430
|
+
var gtagConfig = /* @__PURE__ */ __name((measurementId, configParams) => {
|
|
431
|
+
gtagTrack("config", measurementId, configParams);
|
|
432
|
+
}, "gtagConfig");
|
|
433
|
+
|
|
434
|
+
// src/core/adapters/meta.ts
|
|
435
|
+
var metaTrack = /* @__PURE__ */ __name((event, data) => {
|
|
436
|
+
if (typeof window === "undefined") {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (typeof window.fbq !== "undefined") {
|
|
440
|
+
try {
|
|
441
|
+
if (data) {
|
|
442
|
+
window.fbq("track", event, data);
|
|
443
|
+
} else {
|
|
444
|
+
window.fbq("track", event);
|
|
445
|
+
}
|
|
446
|
+
} catch (error) {
|
|
447
|
+
console.log("fbqTrack error", error);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}, "metaTrack");
|
|
451
|
+
|
|
452
|
+
// src/core/tracking/dispatcher.ts
|
|
453
|
+
function track(config) {
|
|
454
|
+
const { platform, ...params } = config;
|
|
455
|
+
if (!isPlatformAvailable(platform)) {
|
|
456
|
+
logger.warn(`Platform ${platform} is not available`);
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
try {
|
|
460
|
+
switch (platform) {
|
|
461
|
+
case "gtag": {
|
|
462
|
+
const gtagParams = params;
|
|
463
|
+
handleGtagTrack(gtagParams);
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
case "meta": {
|
|
467
|
+
const metaParams = params;
|
|
468
|
+
handleMetaTrack(metaParams);
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
default:
|
|
472
|
+
logger.warn(`Unsupported platform: ${platform}`);
|
|
473
|
+
}
|
|
474
|
+
} catch (error) {
|
|
475
|
+
logger.error(`Failed to track on platform ${platform}:`, error);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
__name(track, "track");
|
|
479
|
+
function handleGtagTrack(params) {
|
|
480
|
+
const { eventName, measurementId, ...restParams } = params;
|
|
481
|
+
if (measurementId) {
|
|
482
|
+
gtagConfig(measurementId, {});
|
|
483
|
+
}
|
|
484
|
+
const eventParams = { ...restParams };
|
|
485
|
+
if (eventParams.transactionId && !eventParams.transaction_id) {
|
|
486
|
+
eventParams.transaction_id = eventParams.transactionId;
|
|
487
|
+
delete eventParams.transactionId;
|
|
488
|
+
}
|
|
489
|
+
gtagEvent(eventName, eventParams);
|
|
490
|
+
logger.log(`Gtag conversion tracked: ${eventName}`, eventParams);
|
|
491
|
+
}
|
|
492
|
+
__name(handleGtagTrack, "handleGtagTrack");
|
|
493
|
+
function handleMetaTrack(params) {
|
|
494
|
+
const { event, data } = params;
|
|
495
|
+
if (!event) {
|
|
496
|
+
logger.warn("Meta Pixel event name is required");
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
metaTrack(event, data);
|
|
500
|
+
logger.log(`Meta Pixel event tracked: ${event}`, data);
|
|
501
|
+
}
|
|
502
|
+
__name(handleMetaTrack, "handleMetaTrack");
|
|
503
|
+
|
|
504
|
+
// src/core/tracking/with-tracking.ts
|
|
505
|
+
function executeTracking(trackPoint, trackConfig) {
|
|
506
|
+
const configs = Array.isArray(trackConfig) ? trackConfig : [trackConfig ?? {}];
|
|
507
|
+
configs.forEach((config) => {
|
|
508
|
+
try {
|
|
509
|
+
track(config);
|
|
510
|
+
} catch (error) {
|
|
511
|
+
logger.error("withTracking: \u57CB\u70B9\u6267\u884C\u5931\u8D25", error);
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
if (typeof window !== "undefined" && !!trackPoint && window.__FUN_TRACK_TAGS__?.[trackPoint ?? ""]?.length > 0) {
|
|
515
|
+
trackByTags({
|
|
516
|
+
tags: window.__FUN_TRACK_TAGS__?.[trackPoint ?? ""] ?? [],
|
|
517
|
+
data: [{ event: "custom" }]
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
__name(executeTracking, "executeTracking");
|
|
522
|
+
function withTracking(fn, config) {
|
|
523
|
+
const {
|
|
524
|
+
trackConfig,
|
|
525
|
+
timing = "after",
|
|
526
|
+
condition,
|
|
527
|
+
trackOnError = false,
|
|
528
|
+
errorTrackConfig,
|
|
529
|
+
debounce: debounceTime,
|
|
530
|
+
throttle: throttleTime,
|
|
531
|
+
trackPoint
|
|
532
|
+
} = config;
|
|
533
|
+
function wrappedFunction(...args) {
|
|
534
|
+
if (condition && !condition(args)) {
|
|
535
|
+
return fn(...args);
|
|
536
|
+
}
|
|
537
|
+
const getTrackConfig = /* @__PURE__ */ __name((result) => {
|
|
538
|
+
return typeof trackConfig === "function" ? trackConfig(args, result) : trackConfig;
|
|
539
|
+
}, "getTrackConfig");
|
|
540
|
+
if (timing === "before" || timing === "both") {
|
|
541
|
+
const config2 = getTrackConfig();
|
|
542
|
+
executeTracking(trackPoint, config2);
|
|
543
|
+
}
|
|
544
|
+
try {
|
|
545
|
+
const result = fn(...args);
|
|
546
|
+
if (result instanceof Promise) {
|
|
547
|
+
return result.then((resolvedResult) => {
|
|
548
|
+
if (timing === "after" || timing === "both") {
|
|
549
|
+
const config2 = getTrackConfig(resolvedResult);
|
|
550
|
+
executeTracking(trackPoint, config2);
|
|
551
|
+
}
|
|
552
|
+
return resolvedResult;
|
|
553
|
+
}).catch((error) => {
|
|
554
|
+
if (trackOnError && errorTrackConfig) {
|
|
555
|
+
executeTracking(trackPoint, errorTrackConfig(error, args));
|
|
556
|
+
}
|
|
557
|
+
throw error;
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
if (timing === "after" || timing === "both") {
|
|
561
|
+
const config2 = getTrackConfig(result);
|
|
562
|
+
executeTracking(trackPoint, config2);
|
|
563
|
+
}
|
|
564
|
+
return result;
|
|
565
|
+
} catch (error) {
|
|
566
|
+
if (trackOnError && errorTrackConfig) {
|
|
567
|
+
executeTracking(trackPoint, errorTrackConfig(error, args));
|
|
568
|
+
}
|
|
569
|
+
throw error;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
__name(wrappedFunction, "wrappedFunction");
|
|
573
|
+
if (typeof window !== "undefined" && !!trackPoint) {
|
|
574
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
575
|
+
if (urlParams.has("TRACK_DEV")) {
|
|
576
|
+
return ((...args) => {
|
|
577
|
+
window.open(
|
|
578
|
+
`http://localhost:3002/tracking?trackPoint=${trackPoint}`,
|
|
579
|
+
"_blank"
|
|
580
|
+
);
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
if (debounceTime) {
|
|
585
|
+
return debounce(wrappedFunction, debounceTime);
|
|
586
|
+
}
|
|
587
|
+
if (throttleTime) {
|
|
588
|
+
return throttle(wrappedFunction, throttleTime);
|
|
589
|
+
}
|
|
590
|
+
return wrappedFunction;
|
|
591
|
+
}
|
|
592
|
+
__name(withTracking, "withTracking");
|
|
593
|
+
function useTracking(config) {
|
|
594
|
+
return (fn) => {
|
|
595
|
+
return withTracking(fn, config);
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
__name(useTracking, "useTracking");
|
|
599
|
+
|
|
600
|
+
// src/pixels/GtagPixel.tsx
|
|
601
|
+
var import_react = require("react");
|
|
602
|
+
var import_script = __toESM(require("next/script"));
|
|
603
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
604
|
+
var GtagPixel = /* @__PURE__ */ __name((props) => {
|
|
605
|
+
const {
|
|
606
|
+
cookieConsentEnabled,
|
|
607
|
+
pixelIds,
|
|
608
|
+
strategy,
|
|
609
|
+
onPixelLoaded,
|
|
610
|
+
...scriptProps
|
|
611
|
+
} = props;
|
|
612
|
+
const pixelIdsKey = (0, import_react.useMemo)(() => JSON.stringify(pixelIds), [pixelIds]);
|
|
613
|
+
const pixelIdsArray = (0, import_react.useMemo)(
|
|
614
|
+
() => Array.isArray(pixelIds) ? pixelIds : [pixelIds],
|
|
615
|
+
[pixelIdsKey]
|
|
616
|
+
);
|
|
617
|
+
const onLoadRef = (0, import_react.useRef)(onPixelLoaded);
|
|
618
|
+
(0, import_react.useEffect)(() => {
|
|
619
|
+
onLoadRef.current = onPixelLoaded;
|
|
620
|
+
}, [onPixelLoaded]);
|
|
621
|
+
const initializeGtag = /* @__PURE__ */ __name((pixelId) => {
|
|
622
|
+
try {
|
|
623
|
+
window.dataLayer = window.dataLayer || [];
|
|
624
|
+
if (typeof window.gtag !== "function") {
|
|
625
|
+
window.gtag = /* @__PURE__ */ __name(function gtag() {
|
|
626
|
+
window.dataLayer.push(arguments);
|
|
627
|
+
}, "gtag");
|
|
628
|
+
}
|
|
629
|
+
window.gtag("js", /* @__PURE__ */ new Date());
|
|
630
|
+
window.gtag("config", pixelId, {
|
|
631
|
+
allow_enhanced_conversions: true
|
|
632
|
+
});
|
|
633
|
+
console.log(`\u2705 GtagPixel ${pixelId} initialized`);
|
|
634
|
+
} catch (error) {
|
|
635
|
+
console.error(`Failed to initialize GtagPixel ${pixelId}:`, error);
|
|
636
|
+
}
|
|
637
|
+
}, "initializeGtag");
|
|
638
|
+
(0, import_react.useEffect)(() => {
|
|
639
|
+
if (!cookieConsentEnabled || typeof window === "undefined") return;
|
|
640
|
+
if (typeof window.gtag !== "undefined" || typeof window.dataLayer !== "undefined") {
|
|
641
|
+
console.log("\u2705 Gtag already available");
|
|
642
|
+
pixelIdsArray.forEach((pixelId) => initializeGtag(pixelId));
|
|
643
|
+
onLoadRef.current?.();
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
const checkScriptLoaded = setInterval(() => {
|
|
647
|
+
if (typeof window.gtag !== "undefined" || typeof window.dataLayer !== "undefined") {
|
|
648
|
+
console.log("\u2705 Gtag became available!");
|
|
649
|
+
clearInterval(checkScriptLoaded);
|
|
650
|
+
pixelIdsArray.forEach((pixelId) => initializeGtag(pixelId));
|
|
651
|
+
onLoadRef.current?.();
|
|
652
|
+
}
|
|
653
|
+
}, 100);
|
|
654
|
+
const timeout = setTimeout(() => {
|
|
655
|
+
clearInterval(checkScriptLoaded);
|
|
656
|
+
console.warn("\u26A0\uFE0F Timeout waiting for gtag");
|
|
657
|
+
}, 5e3);
|
|
658
|
+
return () => {
|
|
659
|
+
clearInterval(checkScriptLoaded);
|
|
660
|
+
clearTimeout(timeout);
|
|
661
|
+
};
|
|
662
|
+
}, [cookieConsentEnabled, pixelIdsArray]);
|
|
663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: pixelIdsArray.length > 0 && pixelIdsArray.map((pixelId, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
664
|
+
import_script.default,
|
|
665
|
+
{
|
|
666
|
+
id: `GtagPixel_${pixelId}_${index}`,
|
|
667
|
+
type: cookieConsentEnabled ? "text/plain" : "text/javascript",
|
|
668
|
+
"data-category": "targeting",
|
|
669
|
+
strategy,
|
|
670
|
+
src: `https://www.googletagmanager.com/gtag/js?id=${pixelId}`,
|
|
671
|
+
onLoad: () => {
|
|
672
|
+
console.log(`\u2705 GtagPixel ${pixelId} loaded from network`);
|
|
673
|
+
initializeGtag(pixelId);
|
|
674
|
+
},
|
|
675
|
+
onError: () => {
|
|
676
|
+
console.error(`\u274C GtagPixel ${pixelId} script load error`);
|
|
677
|
+
},
|
|
678
|
+
...scriptProps
|
|
679
|
+
},
|
|
680
|
+
pixelId
|
|
681
|
+
)) });
|
|
682
|
+
}, "GtagPixel");
|
|
683
|
+
var GtagPixel_default = GtagPixel;
|
|
684
|
+
|
|
685
|
+
// src/pixels/MetaPixel.tsx
|
|
686
|
+
var import_react2 = require("react");
|
|
687
|
+
var import_script2 = __toESM(require("next/script"));
|
|
688
|
+
var import_jsx_runtime2 = (
|
|
689
|
+
// 添加 cookieConsentEnabled 条件
|
|
690
|
+
require("react/jsx-runtime")
|
|
691
|
+
);
|
|
692
|
+
var MetaPixel = /* @__PURE__ */ __name((props) => {
|
|
693
|
+
const {
|
|
694
|
+
cookieConsentEnabled,
|
|
695
|
+
pixelIds,
|
|
696
|
+
strategy,
|
|
697
|
+
onPixelLoaded,
|
|
698
|
+
...scriptProps
|
|
699
|
+
} = props;
|
|
700
|
+
const pixelIdsKey = (0, import_react2.useMemo)(() => JSON.stringify(pixelIds), [pixelIds]);
|
|
701
|
+
const pixelIdsArray = (0, import_react2.useMemo)(
|
|
702
|
+
() => Array.isArray(pixelIds) ? pixelIds : [pixelIds],
|
|
703
|
+
[pixelIdsKey]
|
|
704
|
+
);
|
|
705
|
+
const onLoadRef = (0, import_react2.useRef)(onPixelLoaded);
|
|
706
|
+
(0, import_react2.useEffect)(() => {
|
|
707
|
+
onLoadRef.current = onPixelLoaded;
|
|
708
|
+
}, [onPixelLoaded]);
|
|
709
|
+
(0, import_react2.useEffect)(() => {
|
|
710
|
+
if (!cookieConsentEnabled || typeof window === "undefined") return;
|
|
711
|
+
if (typeof window.fbq !== "undefined") {
|
|
712
|
+
console.log("\u2705 window.fbq already available");
|
|
713
|
+
onLoadRef.current?.();
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
const checkScriptLoaded = setInterval(() => {
|
|
717
|
+
if (typeof window.fbq !== "undefined") {
|
|
718
|
+
console.log("\u2705 window.fbq became available!");
|
|
719
|
+
clearInterval(checkScriptLoaded);
|
|
720
|
+
onLoadRef.current?.();
|
|
721
|
+
}
|
|
722
|
+
}, 100);
|
|
723
|
+
const timeout = setTimeout(() => {
|
|
724
|
+
clearInterval(checkScriptLoaded);
|
|
725
|
+
console.warn("\u26A0\uFE0F Timeout waiting for window.fbq");
|
|
726
|
+
}, 5e3);
|
|
727
|
+
return () => {
|
|
728
|
+
clearInterval(checkScriptLoaded);
|
|
729
|
+
clearTimeout(timeout);
|
|
730
|
+
};
|
|
731
|
+
}, [cookieConsentEnabled]);
|
|
732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: pixelIdsArray?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
734
|
+
import_script2.default,
|
|
735
|
+
{
|
|
736
|
+
id: "MetaPixel",
|
|
737
|
+
strategy,
|
|
738
|
+
type: cookieConsentEnabled ? "text/plain" : "text/javascript",
|
|
739
|
+
"data-category": "targeting",
|
|
740
|
+
src: `https://connect.facebook.net/en_US/fbevents.js`,
|
|
741
|
+
onLoad: () => {
|
|
742
|
+
console.log("\u2705 MetaPixel main script loaded from network");
|
|
743
|
+
},
|
|
744
|
+
onError: () => {
|
|
745
|
+
console.error("\u274C MetaPixel main script load error");
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
"MetaPixel"
|
|
749
|
+
),
|
|
750
|
+
pixelIdsArray.map((pixelId, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
751
|
+
import_script2.default,
|
|
752
|
+
{
|
|
753
|
+
id: `MetaPixel_${pixelId}_${index}`,
|
|
754
|
+
strategy,
|
|
755
|
+
type: "text/javascript",
|
|
756
|
+
dangerouslySetInnerHTML: {
|
|
757
|
+
__html: `
|
|
758
|
+
!function(f,b,n)
|
|
759
|
+
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
|
760
|
+
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
|
761
|
+
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
|
762
|
+
n.queue=[];}(window, document);
|
|
763
|
+
fbq('init', '${pixelId}');
|
|
764
|
+
fbq('track', 'PageView');
|
|
765
|
+
`
|
|
766
|
+
},
|
|
767
|
+
onError: () => {
|
|
768
|
+
console.error(`\u274C MetaPixel ${pixelId} script error`);
|
|
769
|
+
},
|
|
770
|
+
...scriptProps
|
|
771
|
+
},
|
|
772
|
+
pixelId
|
|
773
|
+
))
|
|
774
|
+
] }) });
|
|
775
|
+
}, "MetaPixel");
|
|
776
|
+
var MetaPixel_default = MetaPixel;
|
|
777
|
+
|
|
778
|
+
// src/pixels/PixelsManager.tsx
|
|
779
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
780
|
+
var PIXEL_COMPONENTS = {
|
|
781
|
+
gtag: GtagPixel_default,
|
|
782
|
+
meta: MetaPixel_default
|
|
783
|
+
};
|
|
784
|
+
var PixelsManager = /* @__PURE__ */ __name((config) => {
|
|
785
|
+
const { type, ...pixelProps } = config;
|
|
786
|
+
const PixelComponent = PIXEL_COMPONENTS[type];
|
|
787
|
+
if (!PixelComponent) {
|
|
788
|
+
return null;
|
|
789
|
+
}
|
|
790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PixelComponent, { ...pixelProps });
|
|
791
|
+
}, "PixelsManager");
|
|
792
|
+
var PixelsManager_default = PixelsManager;
|
|
793
|
+
|
|
794
|
+
// src/index.ts
|
|
795
|
+
var index_default = {
|
|
796
|
+
track,
|
|
797
|
+
trackByTags,
|
|
798
|
+
withTracking,
|
|
799
|
+
useTracking,
|
|
800
|
+
logger,
|
|
801
|
+
isPlatformAvailable,
|
|
802
|
+
updateScriptType,
|
|
803
|
+
updateScriptsType
|
|
804
|
+
};
|
|
805
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
806
|
+
0 && (module.exports = {
|
|
807
|
+
GtagPixel,
|
|
808
|
+
MetaPixel,
|
|
809
|
+
PixelsManager,
|
|
810
|
+
TrackTagsVersionMap,
|
|
811
|
+
clearTrackTags,
|
|
812
|
+
gtagTrack,
|
|
813
|
+
hasTrackPoint,
|
|
814
|
+
isPlatformAvailable,
|
|
815
|
+
logger,
|
|
816
|
+
metaTrack,
|
|
817
|
+
setTrackTags,
|
|
818
|
+
track,
|
|
819
|
+
trackByTags,
|
|
820
|
+
triggerTrack,
|
|
821
|
+
triggerTrackBatch,
|
|
822
|
+
updateScriptType,
|
|
823
|
+
updateScriptsType,
|
|
824
|
+
useTracking,
|
|
825
|
+
withTracking
|
|
826
|
+
});
|
|
827
|
+
//# sourceMappingURL=index.cjs.map
|