@aranova/tracking-next 0.22.4 → 0.23.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/README.md CHANGED
@@ -471,6 +471,30 @@ sales.trackConversion("phone_click"); // fires a manual event-goal only (no sale
471
471
  APIs; do not use them for new installs. See
472
472
  [conversion-config-schema.md](https://github.com/AranovaIO/aranova_internal/blob/master/docs/tracking-package/conversion-config-schema.md).
473
473
 
474
+ ### Where the config is read from
475
+
476
+ `ARANOVA_TRACKING_CONFIG` carries the business identity, and the SDK composes the
477
+ object URL against the production CDN. Two origins are in play and they are easy to
478
+ conflate:
479
+
480
+ - `endpoint` — where **events** are POSTed (the Aranova API).
481
+ - `cdnBaseUrl` — where the **config object** is GET (object storage / CDN).
482
+
483
+ Switching `NEXT_PUBLIC_ARANOVA_TRACKING_ENDPOINT` to a local backend therefore does
484
+ _not_ move the config fetch. The generated module reads
485
+ `NEXT_PUBLIC_ARANOVA_CDN_BASE_URL` for that, falling back to production:
486
+
487
+ ```
488
+ # .env.local — local object storage only. Leave UNSET in production.
489
+ NEXT_PUBLIC_ARANOVA_CDN_BASE_URL=http://localhost:9100/aranova-demos
490
+ ```
491
+
492
+ No code change is needed; pass `ARANOVA_TRACKING_CONFIG` as-is. Setting this in
493
+ production points every visitor's browser at the wrong origin — events keep
494
+ flowing, so the dashboard looks healthy while on-page conversion firing never
495
+ engages. If you need to override it programmatically,
496
+ `resolveTrackingConfigUrl(ref)` returns the URL a reference resolves to.
497
+
474
498
  ## Consent (v2 — opt-out model)
475
499
 
476
500
  Tracking is **on by default**: the consent-default `<Script>` injected by `GoogleAdsTracking` / `AdPlatformTracking` resolves the visitor's effective consent synchronously from `localStorage` before gtag.js loads — granted unless an explicit, unexpired decline is stored. A decline is honored for **90 days**; a grant never expires. There is no `pending` state and the package ships **no consent UI** — each site provides its own footer "cookie preferences" control and discloses tracking in its privacy policy (that notice is what makes the opt-out model defensible).
@@ -91,6 +91,13 @@ function registerCapability(capability) {
91
91
  registered.add(capability);
92
92
  }
93
93
 
94
+ // ../tracking-core/src/phone.ts
95
+ var import_libphonenumber_js = require("libphonenumber-js");
96
+
97
+ // ../tracking-core/src/resources/tracking-config-runtime.ts
98
+ var DEFAULT_CDN_BASE_URL = "https://demos.aranova.io";
99
+ var RETRY_MAX_MS = 5 * 6e4;
100
+
94
101
  // ../tracking-core/src/resources/blog/schema.ts
95
102
  var import_zod2 = require("zod");
96
103
 
@@ -430,7 +437,7 @@ function parseBlogPostContent(raw) {
430
437
  // ../tracking-core/src/resources/blog/client.ts
431
438
  function createBlogClient(config) {
432
439
  registerCapability("blog_rendering");
433
- const base = config.cdnBaseUrl.replace(/\/+$/, "");
440
+ const base = (config.cdnBaseUrl.trim() || DEFAULT_CDN_BASE_URL).replace(/\/+$/, "");
434
441
  const doFetch = (...args) => (config.fetchImpl ?? fetch)(...args);
435
442
  async function fetchJson(url, init) {
436
443
  try {