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:
@@ -43,27 +43,7 @@ if($this->settings['p24']['sandbox']) {
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
dataLayer.push({ ecommerce: null });
|
||||
dataLayer.push({
|
||||
event: "purchase",
|
||||
ecommerce: {
|
||||
transaction_id: "<?= $this -> order['id'];?>",
|
||||
value: <?= str_replace( ',', '.', $this -> order['order_price'] );?>,
|
||||
currency: "PLN",
|
||||
shipping: 0,
|
||||
items: [
|
||||
<? foreach ( $this -> order['tickets'] as $ticket ):?>
|
||||
{
|
||||
'id': <?= (int)$ticket['product_id'];?>,
|
||||
'name': '<?= $ticket['name'];?>',
|
||||
'quantity': <?= $ticket['quantity'];?>,
|
||||
'price': <?= $ticket['price'];?>
|
||||
}<? if ( $ticket != end( $this -> order['tickets'] ) ) echo ',';?>
|
||||
<? endforeach;?>
|
||||
]
|
||||
}
|
||||
});
|
||||
$( document ).ready( function() {
|
||||
$( "#form_data" ).submit();
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user