Commit 8c1369e2 by halweg

gtag延时

parent 850f50aa
......@@ -72,18 +72,20 @@ $tracking_conversion = $block->getTrackingConversion();
</style>
<script>
dataLayer = [];
window.dataLayer = window.dataLayer || [];
dataLayer.push({
'event': 'purchase',
'value': <?= $totalPrice ?>,
'items': <?= json_encode($googleItems, true) ?>
});
<?php if ($block->getOrderId() && $tracking_show > 0 && !empty($tracking_conversion)) :?>
gtag('event', 'conversion', {
'send_to': '<?= /* @noEscape */ $tracking_conversion ?>',
'value': <?= /* @noEscape */ $totalPrice ?>,
'currency': '<?= /* @noEscape */ $currency ?>',
'transaction_id': '<?= /* @noEscape */ $block->getOrderId() ?>'
});
setTimeout(function () {
gtag('event', 'conversion', {
'send_to': '<?= /* @noEscape */ $tracking_conversion ?>',
'value': <?= /* @noEscape */ $totalPrice ?>,
'currency': '<?= /* @noEscape */ $currency ?>',
'transaction_id': '<?= /* @noEscape */ $block->getOrderId() ?>'
});
}, 1500);
<?php endif;?>
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment