Jump to content

Recommended Posts

Hello everyone!

 

The past few days I was stugling to get Google Analytics module (ganalytics) working on my shop.

 

I will share my experience hoping that some of you might find it useful.

 

FYI:

Testing on PrestaShop 1.5.2; Freshly installed; No custizations apart from these two additional modules:

 

1. Ganalytics 1.8.2;

2. prestashop-1.5.x-paysera-1.6-2014-01-02 (https://support.paysera.com/index.php?/Knowledgebase/Article/View/93/37/prestashop)

 

 

 

So I tested order tracking after setting up ganalytics as instructed for a few days with no luck, these pages never appeared on google analytics:

  • order/step0.html (required)
  • authentication.php (required)
  • order/step1.html (required)
  • order/step2.html (required)
  • order/step3.html (required)

 

Started to google arround and found a lot of people complaining about it. Makes me wonder does this module actually work for any of you?

 

Either way, with help of google analytics debugger for chrome I was able to conclude that pageview beacons are not sent while going through the order procedure.

 

 

Most of the related topics on this forum lead nowhere, but regardless the fact, that I don't speak French, I found a fix for most of this issue here:

 

http://www.prestashop.com/forums/topic/362434-objectif-google-analytics-ps-16/?p=1843162

 

The post above seem to address the issue accurately.

 

pic0.jpg

 

This is my small victory. Now was able to see some order step data on my analytics.

 

To be honest, the French code does not entirely worked for me since it caused "Order-History" to be marked as step0.html, which is wrong.

 

pic1.jpg

 

So I made a small chage:

 

pic2_2.jpg

 

Wrapped the code with additional IF to exclude order-history.

 

 

This was my progress so far when I stated this thread. What I was still missing was:

 

authentication.php - Never appears

order-confirmation.php  - Never appears

 

 

The code above is suppose to send pageview on order-confirmation.php when the client lands on the page with name 'order-confirmation'. Analyzing the actual apache log I can see this matching log line:

 

"GET /order-confirmation?id_cart=.............

 

pic2.jpg

 

So it seems that:

 

1. The client comes back from the payment gateway.

2. Hits /module/mokejimai/validation

3. Gets redirected to the /order-confirmation

4. lands on /order-history

 

So why isn't the pageview beacon sent?

 

Well, as far as I understand, the only page with header is /order-history. Correct me if I'm wrong, but none of the previous 3 pages have header.tpl loaded so no analytics code there.

 

So I came up with this solution:

 

Found PHP function to generate pageview for google analytics.

http://stackoverflow.com/questions/14048998/use-google-analytics-to-track-usage-of-php-api

 

 

Found the php file for the first controler where the client lands after the payment:

/modules/mokejimai/controllers/front/validation.php (my payment gateway module)

 

 

Added the code to generate the pageview:

AnalyticsDoHit("UA-XXXXXXXX-X", "order-confirmation.php", "order-confirmation.php");

 

Success:

 

pic3.jpg

 

 

 

 

 

If you have any questions, I will be happy to help you out.

 

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hi Telnett,

 

Great that you shared your findings with the community!!

 

This might be interesting for you: http://www.prestashop.com/forums/topic/388140-google-analytics-ecommerce-tracking/

 

There are many open bugs in ganalytics module, i.e. it sends false data to GA what is making it unusable. You may want to go through the above topic and verify whether to return to old version of the module.

 

Cheers!

Link to comment
Share on other sites

×
×
  • Create New...