halden Posted September 3 Share Posted September 3 Hello, j'ai ajouté GTM dans mon fichier head.tpl et layout-both-columns.tpl. Le test est validé sur GTM cependant j'aimerais comptabiliser les commandes validées mais je n'y arrive pas. Il me faut une variable qui remonte le montant total de la transaction. Là j'ai testé en ajoutant un script dans order-confirmation.tpl pour récupérer les infos de la commande mais ça ne remonte aucune info : {literal} <script> window.dataLayer = window.dataLayer || []; dataLayer.push({ 'event': 'purchase', 'transactionId': '{$order->id}', 'transactionTotal': {$order->getOrdersTotalPaid()}, 'transactionProducts': [ {foreach from=$order->getProductsDetail() item=product} { 'name': '{$product['product_name']|escape:'html':'UTF-8'}', 'id': '{$product['product_id']}', 'price': {$product['total_price_tax_incl']}, 'quantity': {$product['product_quantity']} }{if !$smarty.foreach.product.last},{/if} {/foreach} ] }); </script> {/literal} Quelqu'un pourrait m'aider svp? Link to comment Share on other sites More sharing options...
Prestashop Addict Posted September 3 Share Posted September 3 Je vous recommande d'analyser le code du module Google Analitics (ps_googleanalytics) Link to comment Share on other sites More sharing options...
halden Posted September 4 Author Share Posted September 4 J'ai trouvé des portions de codes mais j'avoue que cela dépasse totalement mes compétences : // Render the event $eventData = [ 'currency' => $this->context->currency->iso_code, 'value' => $cart['totals']['total']['amount'], 'items' => $items, ]; // Add payment event $gaScripts .= $this->module->getTools()->renderEvent( 'add_payment_info', [ 'currency' => $orderData['currency'], 'value' => (float) $orderData['value'], 'payment_type' => $orderData['payment_type'], 'items' => $orderProducts, ] ); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now