[Changed] trigger and payment receiving

This commit is contained in:
MaxBuhe01 2024-10-25 21:08:52 +02:00
parent 2ec373c95f
commit 3f34973638
2 changed files with 44 additions and 39 deletions

View File

@ -3,16 +3,19 @@
[{assign var="gtmBasketPrice" value=$oxcmp_basket->getPrice()}]
[{assign var="gtmBasketObject" value=$oxcmp_basket}]
[{assign var='gtmCartArticles' value=$gtmBasketObject->getBasketArticles()}]
[{assign var="gtmPaymentObject" value=$oView->getPayment()}]
[{block name="gtm_ga4_add_payment_info_block"}]
[{capture name="gtm_ga4_add_payment_info"}]
[{strip}]
$(document).ready(function() {
$('#orderStep, #paymentNextStepBottom').on('click', function() {
let selectedPaymentMethod = document.querySelector('input[type="radio"]:checked');
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'add_payment_info',
'eventLabel':'Checkout - Payment info',
'payment_type':'[{$gtmPaymentObject->gtmGetSelectedPaymentName()}]',
'payment_type': selectedPaymentMethod.value,
'ecommerce':
{
'actionField': "Payment-Info",
@ -47,6 +50,8 @@
'debug_mode': 'true'
[{/if}]
});
});
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.gtm_ga4_add_payment_info}]

View File

@ -193,8 +193,8 @@ $aModule = [
// We add it into checkout_order_main ( checkout/order.tpl ) to make sure a payment is actually added;
// we'll also do it like that in the future for add_shipping_info ( not planed yet )
[
'template' => 'page/checkout/order.tpl',
'block' => 'checkout_order_main',
'template' => 'page/checkout/payment.tpl',
'block' => 'checkout_payment_main',
'file' => '/Application/views/blocks/add_payment_info.tpl',
'position' => 150
],