The website is linked with https://www.mysite.com/?utm_campaign=my-campaign
Everything works perfectly well and the campaign is tracked in the Matomo backend.
But now I have a problem I was not able to solve:
I need to read the utm_campaign value with PHP on the website for some advanced statistics.
Currently, for all orders an employee goes to the Matomo backend, reads all orders with timestamp and campaign code and reports it back to our CMS/ERP manually.
I want to report the campaign code to to CMS/ERP automatically, when the user orders a product from the shop.
What I did so far:
Added the Matomo PHP Client to the webshop, initialize it and read getAttributionInfo but it is empty.
include(PORTALDIRECTORY."/__3rd_party/Matomo/MatomoTracker.php"); $matomoTracker = new MatomoTracker(10); $order->setUtmCampaign( $matomoTracker->getAttributionInfo() );
I guess there is something like this missing:
$matomoTracker = new MatomoTracker(10); $matomoTracker->initializeFromCookie($_COOKIE);
but there is no such method
What can I do? Is this possible at all?