@aranova/tracking-next 0.21.0 → 0.22.0
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/blog-server.js +12 -0
- package/dist/blog-server.js.map +1 -1
- package/dist/blog-server.mjs +12 -0
- package/dist/blog-server.mjs.map +1 -1
- package/dist/blog.js +7 -0
- package/dist/blog.js.map +1 -1
- package/dist/blog.mjs +7 -0
- package/dist/blog.mjs.map +1 -1
- package/dist/calendar-server.d.mts +1 -1
- package/dist/calendar-server.d.ts +1 -1
- package/dist/calendar-server.js.map +1 -1
- package/dist/calendar-server.mjs.map +1 -1
- package/dist/calendar.d.mts +2 -2
- package/dist/calendar.d.ts +2 -2
- package/dist/calendar.js +7 -0
- package/dist/calendar.js.map +1 -1
- package/dist/calendar.mjs +7 -0
- package/dist/calendar.mjs.map +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +56 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{phone-utils-B2vHJkNz.d.mts → phone-utils-BhWfNuPS.d.mts} +8 -0
- package/dist/{phone-utils-B2vHJkNz.d.ts → phone-utils-BhWfNuPS.d.ts} +8 -0
- package/dist/phone.d.mts +1 -1
- package/dist/phone.d.ts +1 -1
- package/dist/sales.d.mts +1 -1
- package/dist/sales.d.ts +1 -1
- package/dist/sales.js +7 -0
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +7 -0
- package/dist/sales.mjs.map +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/package.json +1 -1
- package/dist/{sales-CDjXRdmd.d.ts → sales-C7tPnqbq.d.ts} +4 -4
- package/dist/{sales-B3BnYncU.d.mts → sales-H_6bHrL-.d.mts} +4 -4
- package/dist/{transport-DsOY6kcW.d.ts → transport-C-_rFSR4.d.ts} +8 -8
- package/dist/{transport-Bku8zftU.d.mts → transport-yUF5Wize.d.mts} +8 -8
package/dist/index.mjs
CHANGED
|
@@ -258,6 +258,43 @@ var aranovaConsent = (function () {
|
|
|
258
258
|
`.trim();
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
// ../tracking-core/src/capabilities.ts
|
|
262
|
+
var TRACKING_CAPABILITIES = [
|
|
263
|
+
"ad_tags_google",
|
|
264
|
+
"ad_tags_meta",
|
|
265
|
+
"base_tracking",
|
|
266
|
+
"blog_rendering",
|
|
267
|
+
"calendar_read",
|
|
268
|
+
"calendar_write",
|
|
269
|
+
"consent_controls",
|
|
270
|
+
"conversion_goals_auto",
|
|
271
|
+
"conversion_goals_manual",
|
|
272
|
+
"cta_click_capture",
|
|
273
|
+
"form_capture",
|
|
274
|
+
"phone_click_capture",
|
|
275
|
+
"phone_fields"
|
|
276
|
+
];
|
|
277
|
+
var CAPABILITY_DOM_ATTRIBUTE = "data-aranova-capability";
|
|
278
|
+
var registered = /* @__PURE__ */ new Set();
|
|
279
|
+
function registerCapability(capability) {
|
|
280
|
+
registered.add(capability);
|
|
281
|
+
}
|
|
282
|
+
function getRegisteredCapabilities() {
|
|
283
|
+
const all = new Set(registered);
|
|
284
|
+
for (const marker of readDomMarkers()) all.add(marker);
|
|
285
|
+
return Array.from(all).sort();
|
|
286
|
+
}
|
|
287
|
+
function readDomMarkers() {
|
|
288
|
+
if (typeof document === "undefined") return [];
|
|
289
|
+
const known = new Set(TRACKING_CAPABILITIES);
|
|
290
|
+
const found = [];
|
|
291
|
+
for (const node of document.querySelectorAll(`[${CAPABILITY_DOM_ATTRIBUTE}]`)) {
|
|
292
|
+
const value = node.getAttribute(CAPABILITY_DOM_ATTRIBUTE);
|
|
293
|
+
if (value && known.has(value)) found.push(value);
|
|
294
|
+
}
|
|
295
|
+
return found;
|
|
296
|
+
}
|
|
297
|
+
|
|
261
298
|
// ../tracking-core/src/tracking.ts
|
|
262
299
|
var TRACKING_COOKIE_MAX_AGE_SECONDS = 7776e3;
|
|
263
300
|
var TRACKING_PARAM_KEYS = [
|
|
@@ -602,7 +639,8 @@ function createTrackingClientContext(surface, input = {}) {
|
|
|
602
639
|
page_title: input.pageTitle ?? (typeof document === "undefined" ? null : document.title || null),
|
|
603
640
|
referrer: input.referrer ?? (typeof document === "undefined" ? null : document.referrer || null),
|
|
604
641
|
environment: input.environment ?? "production",
|
|
605
|
-
active_gtag_ids: input.activeGtagIds ?? null
|
|
642
|
+
active_gtag_ids: input.activeGtagIds ?? null,
|
|
643
|
+
capabilities: getRegisteredCapabilities()
|
|
606
644
|
};
|
|
607
645
|
}
|
|
608
646
|
function createTrackingSessionUpsertPayload(trackingParams, input, context) {
|
|
@@ -1596,7 +1634,10 @@ function buildContext(surface, sdkVersion, packageName, environment, activeGtagI
|
|
|
1596
1634
|
page_title: typeof document === "undefined" ? null : document.title || null,
|
|
1597
1635
|
referrer: typeof document === "undefined" ? null : document.referrer || null,
|
|
1598
1636
|
environment,
|
|
1599
|
-
active_gtag_ids: activeGtagIds
|
|
1637
|
+
active_gtag_ids: activeGtagIds,
|
|
1638
|
+
// Rebuilt per flush (this runs inside the payload builder), so a client
|
|
1639
|
+
// constructed later on a deeper route still gets reported.
|
|
1640
|
+
capabilities: getRegisteredCapabilities()
|
|
1600
1641
|
};
|
|
1601
1642
|
}
|
|
1602
1643
|
function readTrackingParams() {
|
|
@@ -2189,8 +2230,9 @@ function getEventDefinition(name) {
|
|
|
2189
2230
|
}
|
|
2190
2231
|
|
|
2191
2232
|
// ../tracking-core/src/ingest-typed.ts
|
|
2192
|
-
function createTypedClient(raw,
|
|
2233
|
+
function createTypedClient(raw, registry, options = {}) {
|
|
2193
2234
|
const debug = options.debug ?? false;
|
|
2235
|
+
if (registry.manual?.form_submit) registerCapability("form_capture");
|
|
2194
2236
|
return {
|
|
2195
2237
|
trackEvent(eventType, metadata, opts) {
|
|
2196
2238
|
if (debug) {
|
|
@@ -2597,6 +2639,7 @@ function attachCtaClickCapture(client, config) {
|
|
|
2597
2639
|
return () => {
|
|
2598
2640
|
};
|
|
2599
2641
|
}
|
|
2642
|
+
registerCapability("cta_click_capture");
|
|
2600
2643
|
const selector = autoCapture.selector ?? DEFAULT_CTA_SELECTOR;
|
|
2601
2644
|
function onClick(event) {
|
|
2602
2645
|
const target = event.target;
|
|
@@ -2653,6 +2696,7 @@ function attachPhoneClickCapture(client, config) {
|
|
|
2653
2696
|
return () => {
|
|
2654
2697
|
};
|
|
2655
2698
|
}
|
|
2699
|
+
registerCapability("phone_click_capture");
|
|
2656
2700
|
const selector = autoCapture.selector ?? DEFAULT_TEL_SELECTOR;
|
|
2657
2701
|
function onClick(event) {
|
|
2658
2702
|
const target = event.target;
|
|
@@ -2769,6 +2813,7 @@ function fireRecordedConversions(firing, input, recorded, sale, currency) {
|
|
|
2769
2813
|
}
|
|
2770
2814
|
}
|
|
2771
2815
|
function createSalesClient(config) {
|
|
2816
|
+
if (config.firing) registerCapability("conversion_goals_manual");
|
|
2772
2817
|
async function record(input) {
|
|
2773
2818
|
const currency = input.currency ?? config.defaultCurrency;
|
|
2774
2819
|
if (!currency) {
|
|
@@ -3068,6 +3113,7 @@ var DEFAULT_CHOICE2 = {
|
|
|
3068
3113
|
expiresAt: null
|
|
3069
3114
|
};
|
|
3070
3115
|
function useCookiePreferences(options) {
|
|
3116
|
+
registerCapability("consent_controls");
|
|
3071
3117
|
const [choice, setChoice] = useState(DEFAULT_CHOICE2);
|
|
3072
3118
|
const ttlDays = options?.declineTtlDays;
|
|
3073
3119
|
useEffect(() => {
|
|
@@ -3335,6 +3381,8 @@ function AdPlatformTracking({
|
|
|
3335
3381
|
}, [trackingConfigKey, standalonePageView]);
|
|
3336
3382
|
const gtagAll = trackingConfig ? [] : gtagIds ? Object.values(gtagIds).filter((id) => id != null) : gtagId ? [gtagId] : [];
|
|
3337
3383
|
const metaAll = metaPixelIds ? Object.values(metaPixelIds).filter((id) => id != null) : metaPixelId ? [metaPixelId] : [];
|
|
3384
|
+
if (trackingConfig || gtagAll.length > 0) registerCapability("ad_tags_google");
|
|
3385
|
+
if (metaAll.length > 0) registerCapability("ad_tags_meta");
|
|
3338
3386
|
const gtagLoaderId = gtagAll[0];
|
|
3339
3387
|
const gtagInitScript = gtagAll.length === 1 ? createGtagInitScript(gtagAll[0]) : createGtagInitScriptMulti(gtagAll);
|
|
3340
3388
|
const metaInitScript = metaAll.length === 1 ? createMetaPixelInitScript(metaAll[0]) : createMetaPixelInitScriptMulti(metaAll);
|
|
@@ -3383,7 +3431,7 @@ function GoogleAdsTracking(props) {
|
|
|
3383
3431
|
import { usePathname, useSearchParams } from "next/navigation";
|
|
3384
3432
|
|
|
3385
3433
|
// package.json
|
|
3386
|
-
var version = "0.
|
|
3434
|
+
var version = "0.22.0";
|
|
3387
3435
|
|
|
3388
3436
|
// src/factory.tsx
|
|
3389
3437
|
import {
|
|
@@ -3425,6 +3473,7 @@ function usePhoneConfig() {
|
|
|
3425
3473
|
};
|
|
3426
3474
|
}
|
|
3427
3475
|
function usePhoneField(opts = {}) {
|
|
3476
|
+
registerCapability("phone_fields");
|
|
3428
3477
|
const cfg = usePhoneConfig();
|
|
3429
3478
|
const country = opts.country ?? cfg.defaultCountry;
|
|
3430
3479
|
const display = opts.display ?? cfg.display;
|
|
@@ -3511,6 +3560,8 @@ function createTracking(options) {
|
|
|
3511
3560
|
conversionConfig,
|
|
3512
3561
|
trackingConfig
|
|
3513
3562
|
} = options;
|
|
3563
|
+
registerCapability("base_tracking");
|
|
3564
|
+
if (trackingConfig) registerCapability("conversion_goals_auto");
|
|
3514
3565
|
if (!apiKey || !endpoint) {
|
|
3515
3566
|
if (apiKey || endpoint) {
|
|
3516
3567
|
console.warn(
|
|
@@ -3752,6 +3803,7 @@ function withBusiness(config, path) {
|
|
|
3752
3803
|
return `${path}${separator}business_id=${encodeURIComponent(config.businessId)}`;
|
|
3753
3804
|
}
|
|
3754
3805
|
function createCalendarReadClient(config) {
|
|
3806
|
+
registerCapability("calendar_read");
|
|
3755
3807
|
return {
|
|
3756
3808
|
async listCalendars() {
|
|
3757
3809
|
return calendarRequest(config, "GET", withBusiness(config, "/calendars"));
|