@beworke/pixel 0.1.0-rc.6 → 0.1.0-rc.8
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/CHANGELOG.md +20 -0
- package/README.md +71 -56
- package/RELEASE_CANDIDATE.md +47 -75
- package/dist/Pixel-CCgGk43j.d.ts +797 -0
- package/dist/Pixel-CqbgC_72.d.mts +797 -0
- package/dist/{StorageFactory-tjfzk57c.d.ts → StorageFactory-BRBsnnH7.d.ts} +2 -2
- package/dist/{StorageFactory-CPghDPBj.d.mts → StorageFactory-Dp19Wecr.d.mts} +2 -2
- package/dist/browser/index.cjs.js +3 -0
- package/dist/browser/index.cjs.js.map +1 -0
- package/dist/browser/index.d.mts +55 -0
- package/dist/browser/index.d.ts +55 -0
- package/dist/browser/index.esm.js +3 -0
- package/dist/browser/index.esm.js.map +1 -0
- package/dist/browser/pixel.global.js +4 -0
- package/dist/browser/pixel.global.js.map +1 -0
- package/dist/config/index.cjs.js +1 -1
- package/dist/config/index.cjs.js.map +1 -1
- package/dist/config/index.d.mts +16 -6
- package/dist/config/index.d.ts +16 -6
- package/dist/config/index.esm.js +1 -1
- package/dist/config/index.esm.js.map +1 -1
- package/dist/events/index.cjs.js.map +1 -1
- package/dist/events/index.d.mts +2 -2
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.esm.js.map +1 -1
- package/dist/examples/html-script/README.md +20 -76
- package/dist/examples/html-script/RELEASE_CANDIDATE.md +20 -21
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +41 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +41 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +41 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +41 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +41 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +41 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +41 -48
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +41 -48
- package/dist/examples/html-script/add-to-cart/README.md +6 -3
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +43 -49
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +43 -49
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +43 -49
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +43 -49
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +590 -0
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +43 -49
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +43 -49
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +43 -49
- package/dist/examples/html-script/behavior/example-behavior-engagement.html +5 -5
- package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +5 -5
- package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +5 -5
- package/dist/examples/html-script/behavior/example-behavior-viewport.html +5 -5
- package/dist/examples/html-script/behavior/example-behavior.html +1 -1
- package/dist/examples/html-script/buygoods/example-buygoods-checkout.html +83 -0
- package/dist/examples/html-script/example-basic.html +1 -1
- package/dist/examples/html-script/example-checkout-commerce.html +32 -31
- package/dist/examples/html-script/example-conversion.html +42 -49
- package/dist/examples/html-script/example-global-factory-classic.html +45 -0
- package/dist/examples/html-script/example-global-factory.html +40 -0
- package/dist/examples/html-script/example-integration.html +40 -46
- package/dist/examples/html-script/example-landing-commerce.html +45 -9
- package/dist/examples/html-script/example-runtime-diagnostics.html +5 -5
- package/dist/examples/html-script/example-transport.html +65 -58
- package/dist/examples/html-script/full-funnel/README.md +1 -1
- package/dist/examples/html-script/full-funnel/checkout.html +4 -2
- package/dist/examples/html-script/full-funnel/downsell.html +4 -2
- package/dist/examples/html-script/full-funnel/landing.html +57 -3
- package/dist/examples/html-script/full-funnel/thank-you.html +4 -2
- package/dist/examples/html-script/full-funnel/upsell.html +4 -2
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +41 -48
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +41 -48
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +41 -48
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +41 -48
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +41 -48
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +41 -48
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +41 -48
- package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +41 -48
- package/dist/examples/html-script/lead/example-lead-trigger-auto.html +41 -48
- package/dist/examples/html-script/lead/example-lead-trigger-click.html +41 -48
- package/dist/examples/html-script/release-candidate.html +32 -31
- package/dist/examples/html-script/remove-from-cart/README.md +3 -3
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +41 -48
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +41 -48
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +48 -55
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +41 -48
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +41 -48
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +41 -48
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +41 -48
- package/dist/examples/html-script/search/example-search-attribute.html +41 -48
- package/dist/examples/html-script/search/example-search-button-sync.html +41 -48
- package/dist/examples/html-script/search/example-search-dedupe.html +41 -48
- package/dist/examples/html-script/search/example-search-input.html +41 -48
- package/dist/examples/html-script/search/example-search-manual.html +41 -48
- package/dist/examples/html-script/search/example-search-submit.html +41 -48
- package/dist/examples/html-script/search/example-search-text.html +41 -48
- package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +38 -9
- package/dist/examples/html-script/url-context/example-url-context-landing.html +53 -13
- package/dist/examples/html-script/url-context/example-url-context-upsell.html +48 -10
- package/dist/examples/html-script/url-context/example-url-context.html +55 -21
- package/dist/examples/html-script/view-content/example-view-content-attribute.html +41 -48
- package/dist/examples/html-script/view-content/example-view-content-css.html +41 -48
- package/dist/examples/html-script/view-content/example-view-content-dedupe.html +41 -48
- package/dist/examples/html-script/view-content/example-view-content-empty.html +41 -48
- package/dist/examples/html-script/view-content/example-view-content-manual.html +41 -48
- package/dist/examples/html-script/view-content/example-view-content-product-card.html +41 -48
- package/dist/examples/html-script/view-content/example-view-content-text.html +41 -48
- package/dist/examples/release-candidate/README.md +2 -1
- package/dist/examples/v2/README.md +15 -15
- package/dist/{index-CQAyT5Od.d.ts → index-B8u_3PGG.d.ts} +21 -2
- package/dist/{index-JlKPz4pp.d.mts → index-BxT2d-TK.d.mts} +21 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +21 -782
- package/dist/index.d.ts +21 -782
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/{pixel-CKc4OQUx.d.mts → pixel-C93c-0M2.d.mts} +234 -101
- package/dist/{pixel-BxZZx8l5.d.ts → pixel-DVy4rzj8.d.ts} +234 -101
- package/dist/pixel-default-config-BkAjriVH.d.mts +21 -0
- package/dist/pixel-default-config-Co69vDP3.d.ts +21 -0
- package/dist/pixel-settings-BhfJqA92.d.mts +40 -0
- package/dist/pixel-settings-C0qPFTii.d.ts +40 -0
- package/dist/runtime/index.cjs.js +1 -1
- package/dist/runtime/index.cjs.js.map +1 -1
- package/dist/runtime/index.d.mts +6 -6
- package/dist/runtime/index.d.ts +6 -6
- package/dist/runtime/index.esm.js +1 -1
- package/dist/runtime/index.esm.js.map +1 -1
- package/dist/services/index.cjs.js +1 -1
- package/dist/services/index.cjs.js.map +1 -1
- package/dist/services/index.d.mts +7 -7
- package/dist/services/index.d.ts +7 -7
- package/dist/services/index.esm.js +1 -1
- package/dist/services/index.esm.js.map +1 -1
- package/dist/{types-C75pQP31.d.ts → types-B2aUNHb3.d.ts} +2 -2
- package/dist/{types-BP8dz1gP.d.mts → types-C0J9KUQg.d.mts} +2 -2
- package/dist/{types-DMhzHSVC.d.mts → types-C2dsBog1.d.mts} +2 -2
- package/dist/{types-D_SsCur9.d.ts → types-DcaBYgVI.d.ts} +2 -2
- package/dist/{url-context-BjAsQoVl.d.mts → url-context-Ck2LK18V.d.mts} +4 -2
- package/dist/{url-context-BjAsQoVl.d.ts → url-context-Ck2LK18V.d.ts} +4 -2
- package/dist/v2/global.global.js +1 -1
- package/dist/v2/global.global.js.map +1 -1
- package/dist/v2/index.cjs.js +1 -1
- package/dist/v2/index.cjs.js.map +1 -1
- package/dist/v2/index.d.mts +26 -8
- package/dist/v2/index.d.ts +26 -8
- package/dist/v2/index.esm.js +1 -1
- package/dist/v2/index.esm.js.map +1 -1
- package/docs/public/README.md +20 -15
- package/docs/public/api/exports.md +12 -8
- package/docs/public/api/pixel.md +28 -7
- package/docs/public/configuration/commerce.md +3 -3
- package/docs/public/configuration/modules.md +11 -14
- package/docs/public/configuration/overview.md +41 -25
- package/docs/public/configuration/transport.md +127 -0
- package/docs/public/events/catalog.md +3 -1
- package/docs/public/getting-started/installation.md +20 -15
- package/docs/public/getting-started/quick-start.md +95 -30
- package/docs/public/getting-started/react-nextjs.md +57 -34
- package/docs/public/getting-started/script-tag.md +55 -32
- package/docs/public/guides/funnel-checkout.md +2 -2
- package/docs/public/guides/funnel-full.md +3 -3
- package/docs/public/guides/funnel-landing.md +10 -8
- package/docs/public/limitations.md +6 -5
- package/docs/public/privacy/limitations.md +6 -6
- package/docs/public/release-candidate/validation.md +24 -19
- package/docs/public/troubleshooting.md +7 -6
- package/package.json +15 -14
- package/dist/pixel-default-config-CJl-eypl.d.mts +0 -5
- package/dist/pixel-default-config-aAOujzwp.d.ts +0 -5
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
<div>
|
|
164
164
|
<label for="sender-mode">Sender</label>
|
|
165
165
|
<select id="sender-mode">
|
|
166
|
-
<option value="
|
|
167
|
-
<option value="
|
|
166
|
+
<option value="internal">Internal (endpoint público)</option>
|
|
167
|
+
<option value="test">Test (sem rede)</option>
|
|
168
168
|
</select>
|
|
169
169
|
</div>
|
|
170
170
|
</div>
|
|
@@ -342,7 +342,7 @@
|
|
|
342
342
|
</div>
|
|
343
343
|
</div>
|
|
344
344
|
|
|
345
|
-
<script src="../../
|
|
345
|
+
<script src="../../v2/global.global.js"></script>
|
|
346
346
|
<script>
|
|
347
347
|
(function () {
|
|
348
348
|
var params = new URLSearchParams(window.location.search);
|
|
@@ -471,11 +471,11 @@
|
|
|
471
471
|
var pixelId = pixelIdInput.value.trim();
|
|
472
472
|
var batchMode = document.getElementById('batch-mode').value;
|
|
473
473
|
var senderMode = document.getElementById('sender-mode').value;
|
|
474
|
-
var
|
|
474
|
+
var useInternal = senderMode === 'internal';
|
|
475
475
|
var batchSize = batchMode === 'batch' ? 10 : 1;
|
|
476
476
|
|
|
477
|
-
if (
|
|
478
|
-
throw new Error('Preencha PIXEL_API_ENDPOINT e PIXEL_ID para sender
|
|
477
|
+
if (useInternal && (!endpoint || !pixelId)) {
|
|
478
|
+
throw new Error('Preencha PIXEL_API_ENDPOINT e PIXEL_ID para sender internal.');
|
|
479
479
|
}
|
|
480
480
|
|
|
481
481
|
return {
|
|
@@ -492,8 +492,25 @@
|
|
|
492
492
|
},
|
|
493
493
|
transport: {
|
|
494
494
|
...DEFAULT_PIXEL_CONFIG.transport,
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
enabled: true,
|
|
496
|
+
sender: useInternal
|
|
497
|
+
? { mode: 'internal', baseUrl: endpoint }
|
|
498
|
+
: { mode: 'test', capture: true },
|
|
499
|
+
batch: {
|
|
500
|
+
...DEFAULT_PIXEL_CONFIG.transport.batch,
|
|
501
|
+
enabled: true,
|
|
502
|
+
batchSize: batchSize,
|
|
503
|
+
maxWaitMs: batchMode === 'batch' ? 8000 : 500,
|
|
504
|
+
},
|
|
505
|
+
flush: {
|
|
506
|
+
...DEFAULT_PIXEL_CONFIG.transport.flush,
|
|
507
|
+
flushOnDestroy: true,
|
|
508
|
+
},
|
|
509
|
+
timeout: {
|
|
510
|
+
...DEFAULT_PIXEL_CONFIG.transport.timeout,
|
|
511
|
+
timeoutMs: 15000,
|
|
512
|
+
},
|
|
513
|
+
coordination: { enabled: false },
|
|
497
514
|
},
|
|
498
515
|
commerce: {
|
|
499
516
|
enabled: true,
|
|
@@ -663,29 +680,6 @@
|
|
|
663
680
|
enabled: false,
|
|
664
681
|
},
|
|
665
682
|
},
|
|
666
|
-
transport: {
|
|
667
|
-
...DEFAULT_PIXEL_CONFIG.modules.transport,
|
|
668
|
-
enabled: true,
|
|
669
|
-
mockSender: { enabled: !useHttp },
|
|
670
|
-
sender: { mode: useHttp ? 'http' : 'mock' },
|
|
671
|
-
batch: {
|
|
672
|
-
...DEFAULT_PIXEL_CONFIG.modules.transport.batch,
|
|
673
|
-
enabled: true,
|
|
674
|
-
batchSize: batchSize,
|
|
675
|
-
flushIntervalMs: batchMode === 'batch' ? 8000 : 200,
|
|
676
|
-
maxWaitMs: batchMode === 'batch' ? 8000 : 500,
|
|
677
|
-
},
|
|
678
|
-
flush: {
|
|
679
|
-
...DEFAULT_PIXEL_CONFIG.modules.transport.flush,
|
|
680
|
-
flushIntervalMs: batchMode === 'batch' ? 8000 : 200,
|
|
681
|
-
flushOnDestroy: true,
|
|
682
|
-
},
|
|
683
|
-
timeout: {
|
|
684
|
-
...DEFAULT_PIXEL_CONFIG.modules.transport.timeout,
|
|
685
|
-
timeoutMs: 15000,
|
|
686
|
-
},
|
|
687
|
-
coordination: { enabled: false },
|
|
688
|
-
},
|
|
689
683
|
},
|
|
690
684
|
};
|
|
691
685
|
}
|
|
@@ -719,6 +713,13 @@
|
|
|
719
713
|
var Pixel = window.PixelV2.Pixel;
|
|
720
714
|
pixel = new Pixel(buildConfig());
|
|
721
715
|
await pixel.init();
|
|
716
|
+
if (document.getElementById('sender-mode').value === 'test') {
|
|
717
|
+
pixel.configureTransportTestSender({
|
|
718
|
+
capture: true,
|
|
719
|
+
response: 'success',
|
|
720
|
+
delayMs: 0,
|
|
721
|
+
});
|
|
722
|
+
}
|
|
722
723
|
initCount += 1;
|
|
723
724
|
|
|
724
725
|
var services = pixel.getDebugServices();
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
|
|
150
150
|
<pre id="logs"></pre>
|
|
151
151
|
|
|
152
|
-
<script src="../../
|
|
152
|
+
<script src="../../v2/global.global.js"></script>
|
|
153
153
|
<script>
|
|
154
154
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
155
155
|
|
|
@@ -241,12 +241,12 @@
|
|
|
241
241
|
|
|
242
242
|
function conversionConfig() {
|
|
243
243
|
const cfg = {
|
|
244
|
-
senderMode: '
|
|
244
|
+
senderMode: 'internal',
|
|
245
245
|
timeoutMs: 10000,
|
|
246
246
|
maxAttempts: 4,
|
|
247
247
|
batchSize: 3,
|
|
248
248
|
};
|
|
249
|
-
const useHttp = cfg.senderMode === '
|
|
249
|
+
const useHttp = cfg.senderMode === 'internal';
|
|
250
250
|
return {
|
|
251
251
|
...DEFAULT_PIXEL_CONFIG,
|
|
252
252
|
app: { ...DEFAULT_PIXEL_CONFIG.app, debug: true },
|
|
@@ -256,8 +256,45 @@
|
|
|
256
256
|
},
|
|
257
257
|
transport: {
|
|
258
258
|
...DEFAULT_PIXEL_CONFIG.transport,
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
enabled: true,
|
|
260
|
+
sender: { mode: 'internal', baseUrl: API_ENDPOINT },
|
|
261
|
+
persistence: { enabled: true },
|
|
262
|
+
replay: { enabled: true },
|
|
263
|
+
ordering: { enabled: true },
|
|
264
|
+
coordination: { enabled: true },
|
|
265
|
+
circuitBreaker: {
|
|
266
|
+
enabled: true,
|
|
267
|
+
failureThreshold: 5,
|
|
268
|
+
resetTimeoutMs: 30000,
|
|
269
|
+
halfOpenMaxAttempts: 2,
|
|
270
|
+
},
|
|
271
|
+
backpressure: {
|
|
272
|
+
enabled: true,
|
|
273
|
+
maxQueueSize: 500,
|
|
274
|
+
policy: 'drop_oldest',
|
|
275
|
+
sampleRate: 0.5,
|
|
276
|
+
},
|
|
277
|
+
deadLetter: { enabled: true, maxEntries: 200 },
|
|
278
|
+
compression: { enabled: true, strategy: 'identity' },
|
|
279
|
+
retry: {
|
|
280
|
+
enabled: true,
|
|
281
|
+
maxAttempts: cfg.maxAttempts,
|
|
282
|
+
baseDelayMs: 500,
|
|
283
|
+
maxDelayMs: 4000,
|
|
284
|
+
multiplier: 2,
|
|
285
|
+
},
|
|
286
|
+
batch: {
|
|
287
|
+
enabled: true,
|
|
288
|
+
batchSize: cfg.batchSize,
|
|
289
|
+
maxWaitMs: 5000,
|
|
290
|
+
},
|
|
291
|
+
timeout: { enabled: true, timeoutMs: cfg.timeoutMs },
|
|
292
|
+
offline: { enabled: true },
|
|
293
|
+
flush: {
|
|
294
|
+
enabled: true,
|
|
295
|
+
flushOnDestroy: true,
|
|
296
|
+
prepareUnloadHooks: true,
|
|
297
|
+
},
|
|
261
298
|
},
|
|
262
299
|
modules: {
|
|
263
300
|
...DEFAULT_PIXEL_CONFIG.modules,
|
|
@@ -304,50 +341,6 @@
|
|
|
304
341
|
card: { enabled: false },
|
|
305
342
|
},
|
|
306
343
|
},
|
|
307
|
-
transport: {
|
|
308
|
-
enabled: true,
|
|
309
|
-
mockSender: { enabled: false },
|
|
310
|
-
sender: { mode: 'http' },
|
|
311
|
-
persistence: { enabled: true },
|
|
312
|
-
replay: { enabled: true },
|
|
313
|
-
ordering: { enabled: true },
|
|
314
|
-
coordination: { enabled: true },
|
|
315
|
-
circuitBreaker: {
|
|
316
|
-
enabled: true,
|
|
317
|
-
failureThreshold: 5,
|
|
318
|
-
resetTimeoutMs: 30000,
|
|
319
|
-
halfOpenMaxAttempts: 2,
|
|
320
|
-
},
|
|
321
|
-
backpressure: {
|
|
322
|
-
enabled: true,
|
|
323
|
-
maxQueueSize: 500,
|
|
324
|
-
policy: 'drop_oldest',
|
|
325
|
-
sampleRate: 0.5,
|
|
326
|
-
},
|
|
327
|
-
deadLetter: { enabled: true, maxEntries: 200 },
|
|
328
|
-
compression: { enabled: true, strategy: 'identity' },
|
|
329
|
-
retry: {
|
|
330
|
-
enabled: true,
|
|
331
|
-
maxAttempts: cfg.maxAttempts,
|
|
332
|
-
baseDelayMs: 500,
|
|
333
|
-
maxDelayMs: 4000,
|
|
334
|
-
multiplier: 2,
|
|
335
|
-
},
|
|
336
|
-
batch: {
|
|
337
|
-
enabled: true,
|
|
338
|
-
batchSize: cfg.batchSize,
|
|
339
|
-
flushIntervalMs: 2000,
|
|
340
|
-
maxWaitMs: 5000,
|
|
341
|
-
},
|
|
342
|
-
timeout: { enabled: true, timeoutMs: cfg.timeoutMs },
|
|
343
|
-
offline: { enabled: true },
|
|
344
|
-
flush: {
|
|
345
|
-
enabled: true,
|
|
346
|
-
flushIntervalMs: 2000,
|
|
347
|
-
flushOnDestroy: true,
|
|
348
|
-
prepareUnloadHooks: true,
|
|
349
|
-
},
|
|
350
|
-
},
|
|
351
344
|
},
|
|
352
345
|
};
|
|
353
346
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 base — script clássico</title>
|
|
7
|
+
<script src="../../browser/pixel.global.js"></script>
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
<h1>Pixel base — script clássico</h1>
|
|
12
|
+
<p>
|
|
13
|
+
Top-level <code>await</code> exige <code>type="module"</code> ou um IIFE
|
|
14
|
+
assíncrono. Este exemplo usa <code>.then()</code>.
|
|
15
|
+
</p>
|
|
16
|
+
<button id="lead-button" type="button" disabled>Enviar lead</button>
|
|
17
|
+
<pre id="status">aguardando init…</pre>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
(function () {
|
|
21
|
+
var status = document.getElementById('status');
|
|
22
|
+
var button = document.getElementById('lead-button');
|
|
23
|
+
|
|
24
|
+
Pixel({
|
|
25
|
+
identity: {
|
|
26
|
+
pixelId: 'pix_public_demo',
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
.then(function (pixel) {
|
|
30
|
+
status.textContent = 'Pixel inicializado';
|
|
31
|
+
button.disabled = false;
|
|
32
|
+
button.addEventListener('click', function () {
|
|
33
|
+
pixel.lead({ email: 'user@example.com' });
|
|
34
|
+
status.textContent = 'lead enviado';
|
|
35
|
+
});
|
|
36
|
+
})
|
|
37
|
+
.catch(function (error) {
|
|
38
|
+
console.error(error);
|
|
39
|
+
status.textContent =
|
|
40
|
+
error && error.message ? error.message : String(error);
|
|
41
|
+
});
|
|
42
|
+
})();
|
|
43
|
+
</script>
|
|
44
|
+
</body>
|
|
45
|
+
</html>
|
|
@@ -0,0 +1,40 @@
|
|
|
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 base — global factory</title>
|
|
7
|
+
<script src="../../browser/pixel.global.js"></script>
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body>
|
|
11
|
+
<h1>Pixel base — global factory</h1>
|
|
12
|
+
<p>
|
|
13
|
+
O bundle só registra <code>window.Pixel</code>. A inicialização acontece
|
|
14
|
+
quando <code>Pixel(settings)</code> resolve. Informe apenas
|
|
15
|
+
<code>identity.pixelId</code>; o SDK mescla o restante com os defaults.
|
|
16
|
+
</p>
|
|
17
|
+
<button id="lead-button" type="button">Enviar lead</button>
|
|
18
|
+
<pre id="status">aguardando init…</pre>
|
|
19
|
+
|
|
20
|
+
<script type="module">
|
|
21
|
+
const pixel = await Pixel({
|
|
22
|
+
identity: {
|
|
23
|
+
pixelId: 'pix_7315610',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const status = document.getElementById('status');
|
|
28
|
+
status.textContent = pixel.isInitialized()
|
|
29
|
+
? 'Pixel inicializado'
|
|
30
|
+
: 'Pixel não inicializado';
|
|
31
|
+
|
|
32
|
+
document.getElementById('lead-button').addEventListener('click', () => {
|
|
33
|
+
pixel.lead({
|
|
34
|
+
email: 'user@example.com',
|
|
35
|
+
});
|
|
36
|
+
status.textContent = 'lead enviado';
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
39
|
+
</body>
|
|
40
|
+
</html>
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
<h2>Dispatcher Logs</h2>
|
|
298
298
|
<pre id="logs"></pre>
|
|
299
299
|
|
|
300
|
-
<script src="../../
|
|
300
|
+
<script src="../../v2/global.global.js"></script>
|
|
301
301
|
<script>
|
|
302
302
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
303
303
|
|
|
@@ -379,7 +379,45 @@
|
|
|
379
379
|
identity: { pixelId: PIXEL_ID },
|
|
380
380
|
transport: {
|
|
381
381
|
...DEFAULT_PIXEL_CONFIG.transport,
|
|
382
|
-
|
|
382
|
+
enabled: true,
|
|
383
|
+
sender: { mode: 'internal', baseUrl: API_ENDPOINT },
|
|
384
|
+
persistence: { enabled: true },
|
|
385
|
+
replay: { enabled: true },
|
|
386
|
+
ordering: { enabled: true },
|
|
387
|
+
coordination: { enabled: true },
|
|
388
|
+
circuitBreaker: {
|
|
389
|
+
enabled: true,
|
|
390
|
+
failureThreshold: 5,
|
|
391
|
+
resetTimeoutMs: 30000,
|
|
392
|
+
halfOpenMaxAttempts: 2,
|
|
393
|
+
},
|
|
394
|
+
backpressure: {
|
|
395
|
+
enabled: true,
|
|
396
|
+
maxQueueSize: 500,
|
|
397
|
+
policy: 'drop_oldest',
|
|
398
|
+
sampleRate: 0.5,
|
|
399
|
+
},
|
|
400
|
+
deadLetter: { enabled: true, maxEntries: 200 },
|
|
401
|
+
compression: { enabled: true, strategy: 'identity' },
|
|
402
|
+
retry: {
|
|
403
|
+
enabled: true,
|
|
404
|
+
maxAttempts: 4,
|
|
405
|
+
baseDelayMs: 500,
|
|
406
|
+
maxDelayMs: 4000,
|
|
407
|
+
multiplier: 2,
|
|
408
|
+
},
|
|
409
|
+
batch: {
|
|
410
|
+
enabled: true,
|
|
411
|
+
batchSize: 3,
|
|
412
|
+
maxWaitMs: 5000,
|
|
413
|
+
},
|
|
414
|
+
timeout: { enabled: true, timeoutMs: 10000 },
|
|
415
|
+
offline: { enabled: true },
|
|
416
|
+
flush: {
|
|
417
|
+
enabled: true,
|
|
418
|
+
flushOnDestroy: true,
|
|
419
|
+
prepareUnloadHooks: true,
|
|
420
|
+
},
|
|
383
421
|
},
|
|
384
422
|
attribution: { ...DEFAULT_PIXEL_CONFIG.attribution },
|
|
385
423
|
modules: {
|
|
@@ -415,50 +453,6 @@
|
|
|
415
453
|
enabled: false,
|
|
416
454
|
},
|
|
417
455
|
},
|
|
418
|
-
transport: {
|
|
419
|
-
enabled: true,
|
|
420
|
-
mockSender: { enabled: false },
|
|
421
|
-
sender: { mode: 'http' },
|
|
422
|
-
persistence: { enabled: true },
|
|
423
|
-
replay: { enabled: true },
|
|
424
|
-
ordering: { enabled: true },
|
|
425
|
-
coordination: { enabled: true },
|
|
426
|
-
circuitBreaker: {
|
|
427
|
-
enabled: true,
|
|
428
|
-
failureThreshold: 5,
|
|
429
|
-
resetTimeoutMs: 30000,
|
|
430
|
-
halfOpenMaxAttempts: 2,
|
|
431
|
-
},
|
|
432
|
-
backpressure: {
|
|
433
|
-
enabled: true,
|
|
434
|
-
maxQueueSize: 500,
|
|
435
|
-
policy: 'drop_oldest',
|
|
436
|
-
sampleRate: 0.5,
|
|
437
|
-
},
|
|
438
|
-
deadLetter: { enabled: true, maxEntries: 200 },
|
|
439
|
-
compression: { enabled: true, strategy: 'identity' },
|
|
440
|
-
retry: {
|
|
441
|
-
enabled: true,
|
|
442
|
-
maxAttempts: 4,
|
|
443
|
-
baseDelayMs: 500,
|
|
444
|
-
maxDelayMs: 4000,
|
|
445
|
-
multiplier: 2,
|
|
446
|
-
},
|
|
447
|
-
batch: {
|
|
448
|
-
enabled: true,
|
|
449
|
-
batchSize: 3,
|
|
450
|
-
flushIntervalMs: 2000,
|
|
451
|
-
maxWaitMs: 5000,
|
|
452
|
-
},
|
|
453
|
-
timeout: { enabled: true, timeoutMs: 10000 },
|
|
454
|
-
offline: { enabled: true },
|
|
455
|
-
flush: {
|
|
456
|
-
enabled: true,
|
|
457
|
-
flushIntervalMs: 2000,
|
|
458
|
-
flushOnDestroy: true,
|
|
459
|
-
prepareUnloadHooks: true,
|
|
460
|
-
},
|
|
461
|
-
},
|
|
462
456
|
integrations: {
|
|
463
457
|
enabled: true,
|
|
464
458
|
debug: true,
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
<strong>Contexto:</strong> página de vendas sem checkout. O Core dispara PAGE_VIEW no init
|
|
111
111
|
(<code>trackInitialPageView: true</code>). O enrichment completa o payload com dados do
|
|
112
112
|
carrinho seed (<code>initialItems</code> + catálogo).
|
|
113
|
+
CTA externo usa source <code>type: 'link'</code> (destino do href).
|
|
113
114
|
</div>
|
|
114
115
|
|
|
115
116
|
<div class="hero" data-product-id="main_offer" data-product-price="197" data-currency="BRL">
|
|
@@ -119,6 +120,13 @@
|
|
|
119
120
|
<div class="actions">
|
|
120
121
|
<button type="button" class="primary" data-track="view_content">Ver conteúdo</button>
|
|
121
122
|
<button type="button" data-track="add_to_cart">Quero começar</button>
|
|
123
|
+
<a
|
|
124
|
+
id="checkout-link"
|
|
125
|
+
data-demo-stay
|
|
126
|
+
data-product-id="main_offer"
|
|
127
|
+
href="https://checkout.example.com/pay/offer_landing?product=main_offer"
|
|
128
|
+
style="display:inline-block;text-decoration:none;border-radius:8px;padding:0.5rem 0.85rem;background:#0f766e;color:#fff;border:1px solid #0f766e;font:inherit;"
|
|
129
|
+
>Ir ao checkout (link)</a>
|
|
122
130
|
</div>
|
|
123
131
|
</div>
|
|
124
132
|
|
|
@@ -140,6 +148,7 @@
|
|
|
140
148
|
<li>[ ] <code>commerce.cart.mode</code> = landing_page</li>
|
|
141
149
|
<li>[ ] <code>enrichment.pageView.enabled</code> = true</li>
|
|
142
150
|
<li>[ ] VIEW_CONTENT manual por clique (opcional)</li>
|
|
151
|
+
<li>[ ] Link checkout → <code>ConfiguredLink</code> + ADD_TO_CART</li>
|
|
143
152
|
</ul>
|
|
144
153
|
</div>
|
|
145
154
|
</div>
|
|
@@ -160,7 +169,7 @@
|
|
|
160
169
|
</div>
|
|
161
170
|
</div>
|
|
162
171
|
|
|
163
|
-
<script src="../../
|
|
172
|
+
<script src="../../v2/global.global.js"></script>
|
|
164
173
|
<script>
|
|
165
174
|
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
166
175
|
const API_ENDPOINT =
|
|
@@ -187,9 +196,9 @@
|
|
|
187
196
|
...base,
|
|
188
197
|
app: { ...base.app, environment: 'development', debug: true },
|
|
189
198
|
transport: {
|
|
190
|
-
...
|
|
191
|
-
|
|
192
|
-
|
|
199
|
+
...base.transport,
|
|
200
|
+
enabled: true,
|
|
201
|
+
sender: { mode: 'internal', baseUrl: API_ENDPOINT },
|
|
193
202
|
},
|
|
194
203
|
identity: { ...base.identity, pixelId: PIXEL_ID },
|
|
195
204
|
commerce: {
|
|
@@ -250,11 +259,6 @@
|
|
|
250
259
|
},
|
|
251
260
|
behavior: { ...base.modules.behavior, enabled: false },
|
|
252
261
|
privacy: { ...base.modules.privacy, enabled: false },
|
|
253
|
-
transport: {
|
|
254
|
-
enabled: true,
|
|
255
|
-
mockSender: { enabled: false },
|
|
256
|
-
sender: { mode: 'http' },
|
|
257
|
-
},
|
|
258
262
|
integrations: { ...base.modules.integrations, enabled: false },
|
|
259
263
|
conversion: {
|
|
260
264
|
enabled: true,
|
|
@@ -285,6 +289,31 @@
|
|
|
285
289
|
trigger: 'click',
|
|
286
290
|
fireOnce: false,
|
|
287
291
|
},
|
|
292
|
+
{
|
|
293
|
+
name: 'checkout-product-link',
|
|
294
|
+
type: 'link',
|
|
295
|
+
fireOnce: false,
|
|
296
|
+
match: {
|
|
297
|
+
protocols: ['https:'],
|
|
298
|
+
origins: ['https://checkout.example.com'],
|
|
299
|
+
path: { template: '/pay/:offerId' },
|
|
300
|
+
query: {
|
|
301
|
+
mode: 'all',
|
|
302
|
+
conditions: [
|
|
303
|
+
{ key: 'product', operator: 'exists' },
|
|
304
|
+
],
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
bindings: {
|
|
308
|
+
productId: {
|
|
309
|
+
from: [
|
|
310
|
+
{ source: 'dataset', key: 'productId' },
|
|
311
|
+
{ source: 'query', key: 'product' },
|
|
312
|
+
],
|
|
313
|
+
required: true,
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
},
|
|
288
317
|
],
|
|
289
318
|
},
|
|
290
319
|
removeFromCart: { enabled: false, sources: [] },
|
|
@@ -372,6 +401,13 @@
|
|
|
372
401
|
renderCounts();
|
|
373
402
|
});
|
|
374
403
|
|
|
404
|
+
document.querySelectorAll('[data-demo-stay]').forEach(function (el) {
|
|
405
|
+
el.addEventListener('click', function (event) {
|
|
406
|
+
event.preventDefault();
|
|
407
|
+
appendLog('(playground) navegação bloqueada — link source já trackeou em capture');
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
|
|
375
411
|
initPixel().catch(function (err) {
|
|
376
412
|
els.runtimeStatus.textContent = 'Erro: ' + (err && err.message ? err.message : err);
|
|
377
413
|
});
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<button type="button" id="btn-reinit">Reinit</button>
|
|
25
25
|
</p>
|
|
26
26
|
<pre id="out">Aguardando…</pre>
|
|
27
|
-
<script src="../../
|
|
27
|
+
<script src="../../v2/global.global.js"></script>
|
|
28
28
|
<script>
|
|
29
29
|
(async function () {
|
|
30
30
|
var out = document.getElementById('out');
|
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
...DEFAULT_PIXEL_CONFIG.identity,
|
|
45
45
|
pixelId: 'pix_runtime_diag',
|
|
46
46
|
},
|
|
47
|
+
transport: {
|
|
48
|
+
...DEFAULT_PIXEL_CONFIG.transport,
|
|
49
|
+
enabled: false,
|
|
50
|
+
},
|
|
47
51
|
modules: {
|
|
48
52
|
...DEFAULT_PIXEL_CONFIG.modules,
|
|
49
53
|
core: {
|
|
@@ -55,10 +59,6 @@
|
|
|
55
59
|
...DEFAULT_PIXEL_CONFIG.modules.conversion,
|
|
56
60
|
enabled: true,
|
|
57
61
|
},
|
|
58
|
-
transport: {
|
|
59
|
-
...DEFAULT_PIXEL_CONFIG.modules.transport,
|
|
60
|
-
enabled: false,
|
|
61
|
-
},
|
|
62
62
|
integrations: {
|
|
63
63
|
...DEFAULT_PIXEL_CONFIG.modules.integrations,
|
|
64
64
|
enabled: false,
|