feat(01-purchase-data-layer): add post-payment purchase data layer
Phase 1 complete: - move purchase event to order confirmation after successful payment - add backend purchase payload builder for transaction and ticket lines - remove premature purchase push from przelewy24 redirect view
This commit is contained in:
@@ -1,3 +1,21 @@
|
||||
<?php
|
||||
$purchaseDataLayerJson = null;
|
||||
if (is_array($this->purchase_data_layer ?? null)) {
|
||||
$purchaseDataLayerJson = json_encode(
|
||||
$this->purchase_data_layer,
|
||||
JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_INVALID_UTF8_SUBSTITUTE
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if($purchaseDataLayerJson) : ?>
|
||||
<script type="text/javascript">
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
window.dataLayer.push({ ecommerce: null });
|
||||
window.dataLayer.push(<?= $purchaseDataLayerJson; ?>);
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($this->order_successful === true) : ?>
|
||||
<script type="text/javascript">
|
||||
$.alert({
|
||||
@@ -175,4 +193,4 @@ $.alert({
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user