VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: theo93 on April 16, 2020, 12:48:42 PM

Title: Google Analytics Ecommerce Tracking can't see orders
Post by: theo93 on April 16, 2020, 12:48:42 PM
Hello and i am very glad that i found you.

This is my first post/topic in this foum and it belongs to another category please move it there :)

I have a problem with Google analytics and Google Ads tag.
I followed the instructions that i found online and i added here:  /index.php
This code:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-XXXXX');
  gtag('config', 'AW-XXXXXX');
</script>

I also added here: /html/com_virtuemart/cart/order_done.php
This code:
<!-- Event snippet for Website sale conversion page -->
  <script> gtag('event', 'conversion', { 'send_to': 'AW-XXXX/XXXX', 'transaction_id':'<%= orderId %>' }); </script>

The problem is that i can see the users in the website in Analytics but i can't see the orders in Convertion -> Ecommerce -> Overview.

What should i do?

Thank you very much.
Title: Re: Google Analytics Ecommerce Tracking can't see orders
Post by: pinochico on April 16, 2020, 13:33:23 PM
You can

- manually add script
- use same plugins for VM:
https://www.minijoomla.org/extensions/google/google-tag-manager
https://www.minijoomla.org/extensions/google/google-tag-manager-for-virtuemart

and setup

but allways you must understund how right setup GA and GTM. I think you don't :) (create action in GTM for conversion)
And I think you mixed datalayer for GTM and gtag for Google Retargeting Conversion

Resume:

You must learning how right setup. This is not specific to VM but GA and GTM
Title: Re: Google Analytics Ecommerce Tracking can't see orders
Post by: theo93 on April 16, 2020, 13:44:50 PM
Quote from: pinochico on April 16, 2020, 13:33:23 PM
You can

- manually add script
- use same plugins for VM:
https://www.minijoomla.org/extensions/google/google-tag-manager
https://www.minijoomla.org/extensions/google/google-tag-manager-for-virtuemart

and setup

but allways you must understund how right setup GA and GTM. I think you don't :) (create action in GTM for conversion)
And I think you mixed datalayer for GTM and gtag for Google Retargeting Conversion

Resume:

You must learning how right setup. This is not specific to VM but GA and GTM

Hello and thank you very much for the reply.

i dont use Google Tag Manager, i just went to Analytics -> Admin -> Tracking info and took the code from there.
Should i create Goals in Ecommerce -> Goals ?

If i use these two plugins what else should i do to track the orders and the visitors?

Should i use this code and where should i put it?
gtag('event', 'purchase', {
  "transaction_id": "24.031608523954162",
  "affiliation": "Google online store",
  "value": 23.07,
  "currency": "USD",
  "tax": 1.24,
  "shipping": 0,
  "items": [
    {
      "id": "P12345",
      "name": "Android Warhol T-Shirt",
      "list_name": "Search Results",
      "brand": "Google",
      "category": "Apparel/T-Shirts",
      "variant": "Black",
      "list_position": 1,
      "quantity": 2,
      "price": '2.0'
    },
    {
      "id": "P67890",
      "name": "Flame challenge TShirt",
      "list_name": "Search Results",
      "brand": "MyBrand",
      "category": "Apparel/T-Shirts",
      "variant": "Red",
      "list_position": 2,
      "quantity": 1,
      "price": '3.0'
    }
  ]
});

Best regards