@aranova/tracking-browser 0.17.2 → 0.18.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/README.md CHANGED
@@ -11,10 +11,16 @@ Place the script in the document `<head>` before the rest of the page can run.
11
11
  ```html
12
12
  <script src="https://cdn.jsdelivr.net/npm/@aranova/tracking-browser@0/dist/browser/aranova-tracking.global.js"></script>
13
13
  <script>
14
+ const ARANOVA_TRACKING_CONFIG = {
15
+ cdnUrl: "https://demos.aranova.io/tracking-config/v1/<business_id>-production.json",
16
+ businessId: "<business_id>",
17
+ environment: "production",
18
+ };
19
+
14
20
  window.AranovaTracking.init({
15
21
  apiKey: "aranv_pk_...",
16
22
  endpoint: "https://aranovainternal-production.up.railway.app/tracking",
17
- gtagId: "AW-XXXXXXXXXX",
23
+ trackingConfig: ARANOVA_TRACKING_CONFIG,
18
24
  triggers: {
19
25
  automatic: {
20
26
  page_view: {},
@@ -40,11 +46,11 @@ and the old `renderConsentBanner` option is a deprecated no-op. Wire a footer
40
46
  "cookie preferences" control to the consent API (see **Consent** below) and disclose the
41
47
  tracking + opt-out in the site's privacy policy.
42
48
 
43
- ## Multiple gtag IDs
49
+ ## Legacy static gtag IDs
44
50
 
45
- Pass `gtagIds` (instead of `gtagId`) to install several Google Ads tags at once — e.g. a real
46
- account plus a test MCC. Each fires `gtag('config', …)` on every page; the labels surface in the
47
- dashboard's SDK table. `environment` lets the dashboard filter test traffic out of production.
51
+ `gtagId` and `gtagIds` remain compatibility APIs. Do not use them for new installs:
52
+ static IDs cannot consume dashboard tag changes or tombstones without a site edit. If
53
+ maintaining a legacy install, `gtagIds` loads every entry and takes precedence over `gtagId`.
48
54
 
49
55
  ```html
50
56
  <script>
@@ -128,7 +134,7 @@ Then use ordinary phone links — a single delegated listener does the rest:
128
134
  The number is read from the `href` (normalized to E.164); `section` comes from an optional
129
135
  `data-aranova-section`. **Unlike `cta_click`, a `phone_click` also fires the Google Ads
130
136
  conversion** for a linked phone-call goal (a `CLICK_TO_CALL` action) — auto-fired the moment the
131
- tap is captured, so you never call `trackConversion`. (Firing needs `conversionConfig` wired; see
137
+ tap is captured, so you never call `trackConversion`. (Firing needs `trackingConfig` wired; see
132
138
  below.)
133
139
 
134
140
  Prefer to instrument links yourself? Fire it per element instead — this fires the conversion the
@@ -217,13 +223,20 @@ packages. See the
217
223
 
218
224
  ## On-site conversion firing
219
225
 
220
- Pass `conversionConfig: { cdnUrl }` to `init()` and the SDK fires `gtag('event','conversion', …)`
221
- on-page. The `cdnUrl` is your per-business config object (the dashboard shows it, or
222
- `tracking-cli gen` bakes `ARANOVA_CONFIG_URL`); the SDK reads it from the CDN with
223
- stale-while-revalidate, so **changing the mapping needs no site change**.
226
+ Pass the generated `ARANOVA_TRACKING_CONFIG` reference to `init()`. The browser SDK shares one
227
+ R2 runtime for Google tag loading, page views, automatic goals, and
228
+ `AranovaTracking.sales()` firing. It confirms the current object before any Google command;
229
+ dashboard tag changes, goal remaps, and higher-version disabled tombstones propagate under
230
+ `public, max-age=60, must-revalidate` with no CLI run or site redeploy.
224
231
 
225
232
  ```html
226
233
  <script>
234
+ const ARANOVA_TRACKING_CONFIG = {
235
+ cdnUrl: "https://demos.aranova.io/tracking-config/v1/<business_id>-production.json",
236
+ businessId: "<business_id>",
237
+ environment: "production",
238
+ };
239
+
227
240
  window.AranovaTracking.init({
228
241
  apiKey: "aranv_pk_...",
229
242
  endpoint: "https://api.example.com/tracking",
@@ -231,9 +244,7 @@ stale-while-revalidate, so **changing the mapping needs no site change**.
231
244
  automatic: { page_view: {}, scroll_depth: { thresholds: [50] } },
232
245
  manual: { phone_click: {} },
233
246
  },
234
- conversionConfig: {
235
- cdnUrl: "https://demos.aranova.io/tracking-config/v1/<business_id>-production.json",
236
- },
247
+ trackingConfig: ARANOVA_TRACKING_CONFIG,
237
248
  });
238
249
 
239
250
  // Automatic event-goals (scroll/time/page-view/…) fire THEMSELVES — no code.
@@ -247,8 +258,12 @@ stale-while-revalidate, so **changing the mapping needs no site change**.
247
258
  </script>
248
259
  ```
249
260
 
250
- Firing is consent-gated and de-duped by `transaction_id`. The config bucket needs an R2 CORS
251
- policy — see [conversion-config-schema.md](https://github.com/AranovaIO/aranova_internal/blob/master/docs/tracking-package/conversion-config-schema.md).
261
+ Firing is consent-gated and de-duped by `transaction_id`. Remapping an existing key needs no
262
+ codegen. A **new manual goal key** still requires `tracking-cli gen` to refresh the generated
263
+ key list and site code that calls `trackConversion(key)`. `conversionConfig: { cdnUrl }` and
264
+ generated `ARANOVA_CONFIG_URL` remain legacy compatibility APIs; do not use them for new
265
+ installs. See
266
+ [conversion-config-schema.md](https://github.com/AranovaIO/aranova_internal/blob/master/docs/tracking-package/conversion-config-schema.md).
252
267
 
253
268
  ## Automatic Events
254
269