How to integrate VirtueMart with Matomo via server-side API for order tracking?

Started by marvays, December 03, 2024, 07:18:15 AM

Previous topic - Next topic

marvays

Hello,

I need advice on implementing integration between VirtueMart and Matomo (formerly Piwik) using server-side tracking through the Matomo HTTP Tracking API. My goal is to ensure that data about completed orders is automatically sent from VirtueMart's backend to Matomo.

My situation:
I'm using Joomla 3.x with VirtueMart 3.x.
Matomo is installed on a custom domain.
Currently, I use VP Conversion Tracking for tracking. Unfortunately, due to ad blockers and privacy tools, only about 50% of orders are recorded in analytics.
The standard tracking codes on the frontend are working fine, but I want to replace the tracking of the final step (order confirmation) with API calls directly from the backend.
I plan to send information such as order ID, total amount, product list, and optionally the customer's IP address.
Specific questions:
Where in VirtueMart's code (e.g., which function or file) is the best place to add the API call when the order status changes to "Confirmed"?
Has anyone implemented a similar solution, or does anyone have an example script or process to share?
What should I watch out for during this integration (e.g., performance, security, etc.)?
Note:
I am not a programmer, but I will be preparing this process with the help of artificial intelligence, which assists me in generating code and procedures. Therefore, I would greatly appreciate clear and practical advice.

Thank you in advance for any tips or guidance. If someone has an example of how to implement such a solution, it would be incredibly helpful.

Best regards.

hazael

Quote from: marvays on December 03, 2024, 07:18:15 AMCurrently, I use VP Conversion Tracking for tracking. Unfortunately, due to ad blockers and privacy tools, only about 50% of orders are recorded in analytics.

browsers may block your statistics after detecting the popular name pwik or matomo
in the matomo root directory rename files:
 matomo.js to xyz.js
 matomo.php to xyz.php

in the tracking script also change the same filenames to

_paq.push(['setTrackerUrl', u + 'xyz.php']);
g.src = u + 'xyz.js';

----------------------------------
in config.ini.php add:
[Tracker]
respect_do_not_track = 0
--------------------------------


but there are browser plugins such as ghostery that detect trackers that have popular keywords in the script. you would have to rewrite the entire javascript. However, I think this is nonsense, because if someone consciously does not want to be tracked and uses special applications for this purpose, they have the right to do so. But there are not many such people.

If you want help with implementing matomo, I can help you with that - it's not that difficult. You just need to know the basics of javascript and php. You don't need any tag managers for this. All you need is pure javascript embedded in the php code