Commit 8c1369e2 by halweg

gtag延时

parent 850f50aa
...@@ -72,18 +72,20 @@ $tracking_conversion = $block->getTrackingConversion(); ...@@ -72,18 +72,20 @@ $tracking_conversion = $block->getTrackingConversion();
</style> </style>
<script> <script>
dataLayer = []; window.dataLayer = window.dataLayer || [];
dataLayer.push({ dataLayer.push({
'event': 'purchase', 'event': 'purchase',
'value': <?= $totalPrice ?>, 'value': <?= $totalPrice ?>,
'items': <?= json_encode($googleItems, true) ?> 'items': <?= json_encode($googleItems, true) ?>
}); });
<?php if ($block->getOrderId() && $tracking_show > 0 && !empty($tracking_conversion)) :?> <?php if ($block->getOrderId() && $tracking_show > 0 && !empty($tracking_conversion)) :?>
setTimeout(function () {
gtag('event', 'conversion', { gtag('event', 'conversion', {
'send_to': '<?= /* @noEscape */ $tracking_conversion ?>', 'send_to': '<?= /* @noEscape */ $tracking_conversion ?>',
'value': <?= /* @noEscape */ $totalPrice ?>, 'value': <?= /* @noEscape */ $totalPrice ?>,
'currency': '<?= /* @noEscape */ $currency ?>', 'currency': '<?= /* @noEscape */ $currency ?>',
'transaction_id': '<?= /* @noEscape */ $block->getOrderId() ?>' 'transaction_id': '<?= /* @noEscape */ $block->getOrderId() ?>'
}); });
}, 1500);
<?php endif;?> <?php endif;?>
</script> </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