Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass information from frontend tracking for API usage in the backend? #12563

Closed
lode opened this issue Feb 15, 2018 · 1 comment
Closed
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@lode
Copy link

lode commented Feb 15, 2018

I'm mostly using piwik in the frontend via javascript, but now I want to use backend for the ecommerce tracking.

The basics seem to work. I use addEcommerceItem() and doTrackEcommerceCartUpdate() or doTrackEcommerceOrder() without any other calls. With this, the Ecommerce > Overview / Ecommerce Log / Products seem to work fine.

However, all orders are tracked on a single visitor, one with the IP address of the backend server :)
I don't really care that much about that. But I probably want to separate them to have a useful Ecommerce > Sales screen. Mainly Sales by Referrers > Campaign Names is empty which I would like to use.

I saw it is possible to pass all kind of client data (IP, url, user agent, etc) via the API as well. There's a lot to pass, but what is needed?

On top of that, the campaign is often not a campaign on the product page. Thus someone visits a page with a campaign and is tracked via the frontend, getting a cookie. Then later they navigate to the product page but the campaign is not part of that request anymore. Only the cookie connects the both.

To conclude: is there a way to get the campaign info in the backend when people visit a follow up page? And how can I pass that data via the backend API?

@tsteur
Copy link
Member

tsteur commented Feb 15, 2018

It depends on your backend language. I suggest you have a look at how PHP tracker does it as it detects user agent, referrer, url, ...

And you want to load "visitorCookie" like this: https://github.com/matomo-org/matomo-php-tracker/blob/master/PiwikTracker.php#L1290

For any further question please ask in the developer forum: https://forum.matomo.org/c/plugins-platform

@tsteur tsteur closed this as completed Feb 15, 2018
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

2 participants