Jump to content

Adding GA to shop


SzymonBl

Recommended Posts

Hello,

I'm using prestashop 8.2, and i need to add GA transaction tracking to my site. Base statistics module doesn't suit me, and GA module, does not work, for some reason i can't add account.

Google Tag is added, and working, it tracks active users, and all primary data about them

And for transactions, I added this code to order confirmation page, it is from Chat GPT, because i could not find any info on how to add this tag.


    window.dataLayer = window.dataLayer || [];
    window.dataLayer.push({
        'event': 'purchase',
        'transaction_id': '{$order.details.reference}',
        'value': {$order.totals.total.amount},
        'currency': "PLN",
        'items': [
            {foreach from=$order.products item=product name=productLoop}
                {
                    'item_name': '{$product.name|escape:"javascript"}',
                    'item_id': '{$product.id_product}',
                    'price': {$product.unit_price_tax_incl},
                    'quantity': {$product.quantity}
                }{if not $smarty.foreach.productLoop.last},{/if}
            {/foreach}
        ]
    });

(In script tags)

The problem is, only orders in debug mode are being tracked, rest is not.

Is anyone able to help me setup those statistics? Or tell me where to look?

 

Thanks for response in advance

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...