@JE4GLE opened this Issue on December 13th 2020

Hello,

I use a combination of the HTTP Tracking API with PHP and the JavaScript Tracker. The PHP side tracks page views, ECommerce and other events, so that every page view and transaction is reported and not lost by users blocking the JavaScript tracker. In addition to the PHP side, the JavaScript tracker tracks the rest, like content tracking. This has the disadvantage that page views are not tracked using the JavaScript tracker and I lose important data like Performance tracking (Plugins are not so important, but share the principle).

My suggestion would be to allow sending performance and browser plugins without a page view. Maybe using an event or a separate method like trackPerformance(), which should not be used in combination with trackPageView([customTitle]).

Thank you!

@tsteur commented on December 13th 2020 Member

Hi @JE4GLE

for page performance metrics this might be already the case if you track for example an event on the page. Then Matomo would currently attribute this to the page view. However, this can only work if you track a page view ID server side. The problem is that you can't really know what page view ID to send because it's randomised in JavaScript tracker. So a method to force a specific page view ID to be used should be all that's needed here. Then any event or content tracking request would set the correct page performance metrics on the page view.

@JE4GLE commented on December 13th 2020

Thank you @tsteur

So I would call this method setPageView with my pageview ID in my PHP Tracker and the next event I send using the JavaScript tracker would automatically attach Performance Metrics data to the next event?
Wouldn't it be possible to just send a page view again using JS and because of the same pageview ID it wouldn't track 2 page views? This way, you would have a future-proof way of using the combined advantages of the JS page view and the PHP page view.

@tsteur commented on December 14th 2020 Member

So I would call this method setPageView with my pageview ID in my PHP Tracker and the next event I send using the JavaScript tracker would automatically attach Performance Metrics data to the next event?

Exactly.

Wouldn't it be possible to just send a page view again using JS and because of the same pageview ID it wouldn't track 2 page views? This way, you would have a future-proof way of using the combined advantages of the JS page view and the PHP page view.

I'm not 100% sure but I would very much expect in this case it would record two page views then. In this case you could also simply only track page views through JS? But that wouldn't help I guess when some requests are blocked. It be something to think about though 👍 The problem is it would need a new SELECT DB query on every tracking request to make this work and this can add again quite some load onto the system for a rather rarely used feature. Ideally things would work maybe the other way where data is tracked using JS and if that's not successful then using PHP but this again can take a bit of work and might have downsides.

A very simple solution be to have an option to force a specific pageViewId when calling trackPageView. This would already solve the problem but there are also like you suggest many other additional ways possible.

@Atala commented on February 2nd 2021

Hey

I got the same problem here (I think).

If I understand well, a simpler solution would be to be able to access the page view ID from javascript code (configIdPageView, getConfigIdPageView), so you can send it along to your PHP/backend code and then fill the pv_id param to your backend track request.

However it seems to me that I can't access this property on the global Matomo object or on the Matomo.tracker objects. (although it seems public from the code).

Would that be a solution ?

@JE4GLE commented on February 24th 2021

Hey

I got the same problem here (I think).

If I understand well, a simpler solution would be to be able to access the page view ID from javascript code (configIdPageView, getConfigIdPageView), so you can send it along to your PHP/backend code and then fill the pv_id param to your backend track request.

However it seems to me that I can't access this property on the global Matomo object or on the Matomo.tracker objects. (although it seems public from the code).

Would that be a solution ?

I don't think, this would be an advantage, because you would have to trigger the pageview request with PHP after the page has loaded using an async call. Orherwise you can't send the pageview ID from JavaScript to PHP.
The best way would be to always register the pageview using PHP and provide the id to JavaScript during the page generation.

@JE4GLE commented on March 23rd 2021

Any update here? :)

@tsteur commented on March 23rd 2021 Member

@JE4GLE the feature is not on our roadmap currently. If you're familiar with PHP/JS feel free to create a pull request and we'll be happy to review. We have various docs on https://developer.matomo.org/ , for the tracker we have for example https://developer.matomo.org/guides/jstracker-core

Powered by GitHub Issue Mirror