@beworke/pixel 0.1.0-rc.1 → 0.1.0-rc.6

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.
Files changed (156) hide show
  1. package/CHANGELOG.md +260 -4
  2. package/README.md +65 -118
  3. package/RELEASE_CANDIDATE.md +181 -36
  4. package/dist/{StorageFactory-BhpbB6Jj.d.mts → StorageFactory-CPghDPBj.d.mts} +2 -2
  5. package/dist/{StorageFactory-CAkJJqVD.d.ts → StorageFactory-tjfzk57c.d.ts} +2 -2
  6. package/dist/config/index.cjs.js +1 -1
  7. package/dist/config/index.cjs.js.map +1 -1
  8. package/dist/config/index.d.mts +4 -3
  9. package/dist/config/index.d.ts +4 -3
  10. package/dist/config/index.esm.js +1 -1
  11. package/dist/config/index.esm.js.map +1 -1
  12. package/dist/events/index.cjs.js +1 -1
  13. package/dist/events/index.cjs.js.map +1 -1
  14. package/dist/events/index.d.mts +2 -1
  15. package/dist/events/index.d.ts +2 -1
  16. package/dist/events/index.esm.js +1 -1
  17. package/dist/events/index.esm.js.map +1 -1
  18. package/dist/examples/html-script/README.md +24 -2
  19. package/dist/examples/html-script/RELEASE_CANDIDATE.md +20 -6
  20. package/dist/examples/html-script/add-payment-info/README.md +3 -3
  21. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +66 -48
  22. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +66 -48
  23. package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +65 -47
  24. package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +73 -47
  25. package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +65 -47
  26. package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +56 -47
  27. package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +65 -47
  28. package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +65 -47
  29. package/dist/examples/html-script/add-to-cart/README.md +3 -3
  30. package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +90 -70
  31. package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +103 -81
  32. package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +101 -78
  33. package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +90 -70
  34. package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +81 -67
  35. package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +90 -70
  36. package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +104 -81
  37. package/dist/examples/html-script/behavior/example-behavior-engagement.html +489 -0
  38. package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +350 -0
  39. package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +433 -0
  40. package/dist/examples/html-script/behavior/example-behavior-viewport.html +397 -0
  41. package/dist/examples/html-script/{example-behavior.html → behavior/example-behavior.html} +23 -17
  42. package/dist/examples/html-script/example-checkout-commerce.html +825 -0
  43. package/dist/examples/html-script/example-integration.html +5 -5
  44. package/dist/examples/html-script/example-landing-commerce.html +380 -0
  45. package/dist/examples/html-script/example-runtime-diagnostics.html +108 -0
  46. package/dist/examples/html-script/example-transport.html +5 -5
  47. package/dist/examples/html-script/full-funnel/README.md +64 -0
  48. package/dist/examples/html-script/full-funnel/checkout.html +116 -0
  49. package/dist/examples/html-script/full-funnel/downsell.html +58 -0
  50. package/dist/examples/html-script/full-funnel/landing.html +99 -0
  51. package/dist/examples/html-script/full-funnel/thank-you.html +85 -0
  52. package/dist/examples/html-script/full-funnel/upsell.html +64 -0
  53. package/dist/examples/html-script/initiate-checkout/README.md +6 -6
  54. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +94 -74
  55. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +102 -80
  56. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +103 -80
  57. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +86 -72
  58. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +95 -75
  59. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +103 -83
  60. package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +105 -82
  61. package/dist/examples/html-script/lead/README.md +9 -7
  62. package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +67 -47
  63. package/dist/examples/html-script/lead/example-lead-trigger-auto.html +78 -56
  64. package/dist/examples/html-script/lead/example-lead-trigger-click.html +78 -55
  65. package/dist/examples/html-script/release-candidate.html +187 -76
  66. package/dist/examples/html-script/remove-from-cart/README.md +1 -1
  67. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +93 -73
  68. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +93 -73
  69. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +93 -73
  70. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +84 -70
  71. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +94 -74
  72. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +95 -75
  73. package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +98 -76
  74. package/dist/examples/html-script/search/README.md +1 -1
  75. package/dist/examples/html-script/search/example-search-attribute.html +66 -51
  76. package/dist/examples/html-script/search/example-search-button-sync.html +66 -51
  77. package/dist/examples/html-script/search/example-search-dedupe.html +66 -51
  78. package/dist/examples/html-script/search/example-search-input.html +67 -51
  79. package/dist/examples/html-script/search/example-search-manual.html +57 -48
  80. package/dist/examples/html-script/search/example-search-submit.html +66 -51
  81. package/dist/examples/html-script/search/example-search-text.html +71 -51
  82. package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +63 -0
  83. package/dist/examples/html-script/url-context/example-url-context-landing.html +70 -0
  84. package/dist/examples/html-script/url-context/example-url-context-upsell.html +67 -0
  85. package/dist/examples/html-script/url-context/example-url-context.html +171 -0
  86. package/dist/examples/html-script/view-content/README.md +1 -1
  87. package/dist/examples/html-script/view-content/example-view-content-attribute.html +85 -70
  88. package/dist/examples/html-script/view-content/example-view-content-css.html +85 -70
  89. package/dist/examples/html-script/view-content/example-view-content-dedupe.html +85 -70
  90. package/dist/examples/html-script/view-content/example-view-content-empty.html +85 -70
  91. package/dist/examples/html-script/view-content/example-view-content-manual.html +76 -67
  92. package/dist/examples/html-script/view-content/example-view-content-product-card.html +85 -70
  93. package/dist/examples/html-script/view-content/example-view-content-text.html +90 -73
  94. package/dist/examples/v2/README.md +4 -1
  95. package/dist/{index-DUfFzniE.d.ts → index-CQAyT5Od.d.ts} +170 -3
  96. package/dist/{index-DUfFzniE.d.mts → index-JlKPz4pp.d.mts} +170 -3
  97. package/dist/index.cjs.js +1 -1
  98. package/dist/index.cjs.js.map +1 -1
  99. package/dist/index.d.mts +435 -12
  100. package/dist/index.d.ts +435 -12
  101. package/dist/index.esm.js +1 -1
  102. package/dist/index.esm.js.map +1 -1
  103. package/dist/{pixel-CbeF25mD.d.mts → pixel-BxZZx8l5.d.ts} +248 -72
  104. package/dist/{pixel-CbeF25mD.d.ts → pixel-CKc4OQUx.d.mts} +248 -72
  105. package/dist/{pixel-default-config-1VgLFOiL.d.mts → pixel-default-config-CJl-eypl.d.mts} +1 -1
  106. package/dist/{pixel-default-config-Bxb-Vdd8.d.ts → pixel-default-config-aAOujzwp.d.ts} +1 -1
  107. package/dist/runtime/index.cjs.js +1 -1
  108. package/dist/runtime/index.cjs.js.map +1 -1
  109. package/dist/runtime/index.d.mts +19 -26
  110. package/dist/runtime/index.d.ts +19 -26
  111. package/dist/runtime/index.esm.js +1 -1
  112. package/dist/runtime/index.esm.js.map +1 -1
  113. package/dist/services/index.cjs.js +1 -1
  114. package/dist/services/index.cjs.js.map +1 -1
  115. package/dist/services/index.d.mts +14 -6
  116. package/dist/services/index.d.ts +14 -6
  117. package/dist/services/index.esm.js +1 -1
  118. package/dist/services/index.esm.js.map +1 -1
  119. package/dist/types-BP8dz1gP.d.mts +19 -0
  120. package/dist/types-C75pQP31.d.ts +19 -0
  121. package/dist/types-DMhzHSVC.d.mts +293 -0
  122. package/dist/types-D_SsCur9.d.ts +293 -0
  123. package/dist/url-context-BjAsQoVl.d.mts +85 -0
  124. package/dist/url-context-BjAsQoVl.d.ts +85 -0
  125. package/dist/v2/global.global.js +1 -1
  126. package/dist/v2/global.global.js.map +1 -1
  127. package/dist/v2/index.cjs.js +1 -1
  128. package/dist/v2/index.cjs.js.map +1 -1
  129. package/dist/v2/index.d.mts +8 -6
  130. package/dist/v2/index.d.ts +8 -6
  131. package/dist/v2/index.esm.js +1 -1
  132. package/dist/v2/index.esm.js.map +1 -1
  133. package/docs/public/README.md +75 -0
  134. package/docs/public/api/exports.md +47 -0
  135. package/docs/public/api/pixel.md +65 -0
  136. package/docs/public/configuration/commerce.md +44 -0
  137. package/docs/public/configuration/modules.md +66 -0
  138. package/docs/public/configuration/overview.md +66 -0
  139. package/docs/public/events/catalog.md +65 -0
  140. package/docs/public/getting-started/installation.md +75 -0
  141. package/docs/public/getting-started/quick-start.md +77 -0
  142. package/docs/public/getting-started/react-nextjs.md +55 -0
  143. package/docs/public/getting-started/script-tag.md +57 -0
  144. package/docs/public/guides/funnel-checkout.md +52 -0
  145. package/docs/public/guides/funnel-downsell.md +53 -0
  146. package/docs/public/guides/funnel-full.md +64 -0
  147. package/docs/public/guides/funnel-landing.md +68 -0
  148. package/docs/public/guides/funnel-thank-you.md +48 -0
  149. package/docs/public/guides/funnel-upsell.md +72 -0
  150. package/docs/public/limitations.md +32 -0
  151. package/docs/public/privacy/limitations.md +33 -0
  152. package/docs/public/release-candidate/validation.md +37 -0
  153. package/docs/public/troubleshooting.md +55 -0
  154. package/package.json +13 -1
  155. package/dist/types-CTpRvFKZ.d.ts +0 -71
  156. package/dist/types-DGlBdsAy.d.mts +0 -71
@@ -0,0 +1,397 @@
1
+ <!doctype html>
2
+ <html lang="pt-BR">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Pixel v2 — Behavior Viewport (Etapa 18)</title>
7
+ <style>
8
+ body {
9
+ font-family: system-ui, sans-serif;
10
+ margin: 0;
11
+ padding: 2rem;
12
+ max-width: 960px;
13
+ }
14
+ .hint {
15
+ background: #ecfdf5;
16
+ border: 1px solid #a7f3d0;
17
+ border-radius: 8px;
18
+ padding: 1rem;
19
+ margin-bottom: 1rem;
20
+ font-size: 14px;
21
+ }
22
+ .actions {
23
+ display: flex;
24
+ flex-wrap: wrap;
25
+ gap: 0.5rem;
26
+ margin: 1rem 0;
27
+ }
28
+ button {
29
+ padding: 0.5rem 1rem;
30
+ cursor: pointer;
31
+ }
32
+ .panels {
33
+ display: grid;
34
+ grid-template-columns: 1fr 1fr;
35
+ gap: 1rem;
36
+ }
37
+ @media (max-width: 700px) {
38
+ .panels {
39
+ grid-template-columns: 1fr;
40
+ }
41
+ }
42
+ .panel {
43
+ font-family: ui-monospace, monospace;
44
+ font-size: 12px;
45
+ border-radius: 8px;
46
+ padding: 1rem;
47
+ background: #f4f4f5;
48
+ border: 1px solid #e4e4e7;
49
+ }
50
+ .panel h3 {
51
+ margin: 0 0 0.75rem;
52
+ font-size: 13px;
53
+ font-family: system-ui, sans-serif;
54
+ }
55
+ .panel pre {
56
+ margin: 0;
57
+ white-space: pre-wrap;
58
+ }
59
+ #logs {
60
+ background: #18181b;
61
+ color: #fafafa;
62
+ min-height: 220px;
63
+ max-height: 360px;
64
+ overflow: auto;
65
+ margin-top: 1rem;
66
+ border-radius: 8px;
67
+ padding: 1rem;
68
+ font-family: ui-monospace, monospace;
69
+ font-size: 12px;
70
+ }
71
+ .section {
72
+ min-height: 70vh;
73
+ padding: 2rem;
74
+ margin: 1rem 0;
75
+ border-radius: 12px;
76
+ }
77
+ #hero {
78
+ background: #dbeafe;
79
+ }
80
+ #pricing {
81
+ background: #fef3c7;
82
+ }
83
+ #checkout-cta {
84
+ background: #dcfce7;
85
+ }
86
+ .card {
87
+ display: inline-block;
88
+ width: 160px;
89
+ height: 100px;
90
+ margin: 0.5rem;
91
+ background: #e0e7ff;
92
+ border-radius: 8px;
93
+ text-align: center;
94
+ line-height: 100px;
95
+ }
96
+ #dynamic-zone {
97
+ min-height: 40vh;
98
+ padding: 1rem;
99
+ border: 2px dashed #a1a1aa;
100
+ border-radius: 8px;
101
+ }
102
+ </style>
103
+ </head>
104
+ <body>
105
+ <h1>Behavior Viewport Runtime</h1>
106
+ <p class="hint">
107
+ Etapa 18 — dados fictícios. Emite <code>VIEWPORT_ENTER</code> /
108
+ <code>VIEWPORT_EXIT</code> via Dispatcher. Playground dedicado;
109
+ example-behavior.html mantém viewport desligado.
110
+ </p>
111
+
112
+ <div class="actions">
113
+ <button type="button" id="btn-init">Init</button>
114
+ <button type="button" id="btn-snapshot">Get Debug Snapshot</button>
115
+ <button type="button" id="btn-add">Add Dynamic Target</button>
116
+ <button type="button" id="btn-remove">Remove Dynamic Target</button>
117
+ <button type="button" id="btn-scroll">Scroll to Pricing</button>
118
+ <button type="button" id="btn-destroy">Destroy</button>
119
+ <button type="button" id="btn-reinit">Reinit</button>
120
+ <button type="button" id="btn-clear">Clear Logs</button>
121
+ </div>
122
+
123
+ <div class="panels">
124
+ <div class="panel">
125
+ <h3>Event Counts</h3>
126
+ <pre id="counts">—</pre>
127
+ </div>
128
+ <div class="panel">
129
+ <h3>behavior.viewport</h3>
130
+ <pre id="vp-snap">—</pre>
131
+ </div>
132
+ </div>
133
+
134
+ <div id="logs"></div>
135
+
136
+ <section id="hero" class="section" data-vp="hero">
137
+ <h2>Hero</h2>
138
+ <p>Alvo: hero</p>
139
+ </section>
140
+ <section id="pricing" class="section" data-vp="pricing">
141
+ <h2>Pricing</h2>
142
+ <p>Alvo: pricing</p>
143
+ <div class="card" data-vp-card>Card A</div>
144
+ <div class="card" data-vp-card>Card B</div>
145
+ <div class="card" data-vp-card>Card C</div>
146
+ </section>
147
+ <section id="checkout-cta" class="section" data-vp="checkout">
148
+ <h2>Checkout CTA</h2>
149
+ <button type="button">Comprar (fictício)</button>
150
+ </section>
151
+ <div id="dynamic-zone">
152
+ <p>Zona dinâmica</p>
153
+ </div>
154
+
155
+ <script src="../../../dist/v2/global.global.js"></script>
156
+ <script>
157
+ (function () {
158
+ const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
159
+ const logsEl = document.getElementById('logs');
160
+ const countsEl = document.getElementById('counts');
161
+ const snapEl = document.getElementById('vp-snap');
162
+ let pixel = null;
163
+ let unsubscribe = null;
164
+ let dynCounter = 0;
165
+ const counts = { VIEWPORT_ENTER: 0, VIEWPORT_EXIT: 0, other: 0 };
166
+
167
+ function log(msg, data) {
168
+ const line = document.createElement('div');
169
+ line.textContent =
170
+ '[' +
171
+ new Date().toISOString().slice(11, 23) +
172
+ '] ' +
173
+ msg +
174
+ (data !== undefined ? ' ' + JSON.stringify(data) : '');
175
+ logsEl.prepend(line);
176
+ }
177
+
178
+ function refresh() {
179
+ countsEl.textContent = JSON.stringify(counts, null, 2);
180
+ if (!pixel) {
181
+ snapEl.textContent = 'null';
182
+ return;
183
+ }
184
+ const snap = pixel.getDebugSnapshot();
185
+ snapEl.textContent = JSON.stringify(
186
+ {
187
+ configuredTrackers: snap.behavior.configuredTrackers,
188
+ configuredEngines: snap.behavior.configuredEngines,
189
+ viewport: snap.behavior.viewport,
190
+ },
191
+ null,
192
+ 2
193
+ );
194
+ }
195
+
196
+ function buildConfig() {
197
+ return {
198
+ ...DEFAULT_PIXEL_CONFIG,
199
+ identity: {
200
+ ...DEFAULT_PIXEL_CONFIG.identity,
201
+ pixelId: 'viewport-demo',
202
+ },
203
+ modules: {
204
+ ...DEFAULT_PIXEL_CONFIG.modules,
205
+ core: {
206
+ ...DEFAULT_PIXEL_CONFIG.modules.core,
207
+ enabled: true,
208
+ pageView: {
209
+ ...DEFAULT_PIXEL_CONFIG.modules.core.pageView,
210
+ enabled: false,
211
+ trackInitialPageView: false,
212
+ spa: false,
213
+ },
214
+ session: {
215
+ ...DEFAULT_PIXEL_CONFIG.modules.core.session,
216
+ enabled: false,
217
+ },
218
+ },
219
+ privacy: {
220
+ ...DEFAULT_PIXEL_CONFIG.modules.privacy,
221
+ enabled: false,
222
+ },
223
+ conversion: {
224
+ ...DEFAULT_PIXEL_CONFIG.modules.conversion,
225
+ enabled: false,
226
+ },
227
+ integrations: {
228
+ ...DEFAULT_PIXEL_CONFIG.modules.integrations,
229
+ enabled: false,
230
+ },
231
+ transport: {
232
+ ...DEFAULT_PIXEL_CONFIG.modules.transport,
233
+ enabled: false,
234
+ },
235
+ behavior: {
236
+ ...DEFAULT_PIXEL_CONFIG.modules.behavior,
237
+ enabled: true,
238
+ heartbeat: {
239
+ ...DEFAULT_PIXEL_CONFIG.modules.behavior.heartbeat,
240
+ enabled: false,
241
+ },
242
+ trackers: {
243
+ ...DEFAULT_PIXEL_CONFIG.modules.behavior.trackers,
244
+ scroll: {
245
+ ...DEFAULT_PIXEL_CONFIG.modules.behavior.trackers.scroll,
246
+ enabled: false,
247
+ },
248
+ click: {
249
+ ...DEFAULT_PIXEL_CONFIG.modules.behavior.trackers.click,
250
+ enabled: false,
251
+ },
252
+ idle: {
253
+ ...DEFAULT_PIXEL_CONFIG.modules.behavior.trackers.idle,
254
+ enabled: false,
255
+ },
256
+ visibility: { enabled: false },
257
+ exitIntent: { enabled: false },
258
+ viewport: {
259
+ enabled: true,
260
+ rootMargin: '0px',
261
+ observeMutations: true,
262
+ mutationDebounceMs: 100,
263
+ maxObservedElements: 500,
264
+ targets: [
265
+ {
266
+ key: 'hero',
267
+ selector: '#hero',
268
+ enterThreshold: 0.4,
269
+ exitThreshold: 0.1,
270
+ minVisibleMs: 0,
271
+ trackExit: true,
272
+ once: false,
273
+ },
274
+ {
275
+ key: 'pricing',
276
+ selector: '#pricing',
277
+ enterThreshold: 0.5,
278
+ exitThreshold: 0.2,
279
+ minVisibleMs: 200,
280
+ trackExit: true,
281
+ },
282
+ {
283
+ key: 'checkout',
284
+ selector: '#checkout-cta',
285
+ enterThreshold: 0.5,
286
+ trackExit: true,
287
+ once: true,
288
+ },
289
+ {
290
+ key: 'cards',
291
+ selector: '[data-vp-card]',
292
+ enterThreshold: 0.5,
293
+ exitThreshold: 0,
294
+ once: false,
295
+ },
296
+ {
297
+ key: 'dynamic',
298
+ selector: '[data-vp-dynamic]',
299
+ enterThreshold: 0.3,
300
+ trackExit: true,
301
+ },
302
+ ],
303
+ },
304
+ },
305
+ },
306
+ },
307
+ };
308
+ }
309
+
310
+ function wire() {
311
+ if (!pixel || unsubscribe) return;
312
+ const services = pixel.getDebugServices && pixel.getDebugServices();
313
+ if (!services || !services.dispatcher) return;
314
+ unsubscribe = services.dispatcher.subscribe(function (event) {
315
+ const t = event.type;
316
+ if (t === 'VIEWPORT_ENTER' || t === 'VIEWPORT_EXIT') {
317
+ counts[t] += 1;
318
+ log(t, {
319
+ key: event.key,
320
+ elementId: event.elementId,
321
+ ratio: event.visibilityRatio,
322
+ reason: event.reason,
323
+ });
324
+ } else {
325
+ counts.other += 1;
326
+ }
327
+ refresh();
328
+ });
329
+ }
330
+
331
+ async function doInit() {
332
+ if (pixel && pixel.isInitialized()) {
333
+ log('already initialized');
334
+ return;
335
+ }
336
+ pixel = new Pixel(buildConfig());
337
+ await pixel.init();
338
+ wire();
339
+ log('init ok');
340
+ refresh();
341
+ }
342
+
343
+ async function doDestroy() {
344
+ if (!pixel) return;
345
+ if (unsubscribe) {
346
+ unsubscribe();
347
+ unsubscribe = null;
348
+ }
349
+ await pixel.destroy();
350
+ log('destroy ok');
351
+ refresh();
352
+ }
353
+
354
+ document.getElementById('btn-init').onclick = doInit;
355
+ document.getElementById('btn-destroy').onclick = doDestroy;
356
+ document.getElementById('btn-reinit').onclick = async function () {
357
+ await doDestroy();
358
+ await doInit();
359
+ };
360
+ document.getElementById('btn-snapshot').onclick = function () {
361
+ refresh();
362
+ log('snapshot refreshed');
363
+ };
364
+ document.getElementById('btn-scroll').onclick = function () {
365
+ document.getElementById('pricing').scrollIntoView({
366
+ behavior: 'smooth',
367
+ });
368
+ };
369
+ document.getElementById('btn-add').onclick = function () {
370
+ dynCounter += 1;
371
+ const el = document.createElement('div');
372
+ el.className = 'section';
373
+ el.setAttribute('data-vp-dynamic', '1');
374
+ el.style.background = '#fce7f3';
375
+ el.style.minHeight = '50vh';
376
+ el.textContent = 'Dynamic target #' + dynCounter;
377
+ document.getElementById('dynamic-zone').appendChild(el);
378
+ log('added dynamic', { n: dynCounter });
379
+ };
380
+ document.getElementById('btn-remove').onclick = function () {
381
+ const zone = document.getElementById('dynamic-zone');
382
+ const last = zone.querySelector('[data-vp-dynamic]:last-of-type');
383
+ if (last) {
384
+ last.remove();
385
+ log('removed dynamic');
386
+ }
387
+ };
388
+ document.getElementById('btn-clear').onclick = function () {
389
+ logsEl.textContent = '';
390
+ };
391
+
392
+ refresh();
393
+ log('ready — clique Init (requer dist/v2/global.global.js)');
394
+ })();
395
+ </script>
396
+ </body>
397
+ </html>
@@ -116,8 +116,8 @@
116
116
  <h1>Pixel v2 — Behavior Tracking</h1>
117
117
 
118
118
  <div class="hint">
119
- SCROLL (thresholds + debounce), PAGE_CLICK, RAGE_CLICK (3 cliques / 500ms +
120
- cooldown), VISIBILITY_CHANGE, USER_IDLE / USER_ACTIVE (5s), EXIT_INTENT.
119
+ SCROLL (thresholds + debounce), PAGE_CLICK, RAGE_CLICK (3 cliques / 500ms
120
+ + cooldown), VISIBILITY_CHANGE, USER_IDLE / USER_ACTIVE (5s), EXIT_INTENT.
121
121
  Abra o console para ver cada evento.
122
122
  </div>
123
123
 
@@ -150,7 +150,7 @@
150
150
 
151
151
  <div id="scroll-spacer">Role a página para gerar eventos SCROLL</div>
152
152
 
153
- <script src="../../dist/v2/global.global.js"></script>
153
+ <script src="../../../dist/v2/global.global.js"></script>
154
154
  <script>
155
155
  const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
156
156
 
@@ -284,7 +284,7 @@
284
284
  'dispatcher listeners: ' +
285
285
  listenerCount +
286
286
  '\n' +
287
- 'trackers: scroll, click, visibility, idle, exitIntent';
287
+ 'trackers: scroll, click, visibility, idle, exitIntent · viewport → example-behavior-viewport.html';
288
288
  }
289
289
 
290
290
  function behaviorConfig() {
@@ -313,6 +313,20 @@
313
313
  },
314
314
  behavior: {
315
315
  enabled: true,
316
+ heartbeat: {
317
+ enabled: false,
318
+ intervalMs: 15000,
319
+ hiddenIntervalMs: 60000,
320
+ emitWhenHidden: false,
321
+ emitWhenIdle: true,
322
+ includeSnapshot: true,
323
+ fireImmediately: false,
324
+ },
325
+ engagement: {
326
+ enabled: false,
327
+ weights: { scroll: 0.3, click: 0.3, time: 0.25 },
328
+ thresholds: { low: 30, medium: 70 },
329
+ },
316
330
  trackers: {
317
331
  scroll: {
318
332
  enabled: true,
@@ -335,19 +349,11 @@
335
349
  exitIntent: { enabled: true },
336
350
  viewport: {
337
351
  enabled: false,
338
- selector: '',
339
- selectorType: 'attribute',
340
- visibilityThreshold: 0.5,
341
- },
342
- heartbeat: {
343
- enabled: false,
344
- intervalMs: 5000,
345
- hiddenIntervalMs: 30000,
346
- },
347
- engagement: {
348
- enabled: false,
349
- weights: { scroll: 0.3, click: 0.3, time: 0.25 },
350
- thresholds: { low: 30, medium: 70 },
352
+ targets: [],
353
+ rootMargin: '0px',
354
+ observeMutations: true,
355
+ mutationDebounceMs: 100,
356
+ maxObservedElements: 500,
351
357
  },
352
358
  },
353
359
  },