matomo-org / piwik-dotnet-tracker

C# API client SDK for the Piwik Tracking API
BSD 3-Clause "New" or "Revised" License
74 stars 47 forks source link

Compatibility with Matomo 4 #76

Open tsteur opened 4 years ago

tsteur commented 4 years ago

Hi there,

this issue refs https://github.com/matomo-org/matomo/issues/16397#issue-694540064

in Matomo 4 we're changing the structure of the visitor cookie. I don't know if this SDK reads the cookie of a visitor if one is set?

In the PHP tracker we had to make this change because of it https://github.com/matomo-org/matomo-php-tracker/pull/79/files#diff-cd22a4ca6eb55e6a5ad813334624ed89L1370-L1840

The cookie was changed in https://github.com/matomo-org/matomo/pull/15774/files#diff-1279d666063b65e6d6777f902d11574fR3322-R3330

It used to contain 6 indexes (newVisitor, uuid, createTs, visitCount, currentVisitTs, lastVisitTs) but now contains only indexes: Slot 0: newVisitor Slot 1: uuid Slot 2: createTs

Basically, if this tracker does read the cookie, then the tracker needs to be changed to only read the first to slots from the cookie (cookieVisitorId and createTs) see https://github.com/matomo-org/matomo-php-tracker/pull/79/files#diff-cd22a4ca6eb55e6a5ad813334624ed89L1370-L1840

All other information from the cookie list visit count, currentVisitTs, lastVisitTs is no longer needed in Matomo 4.

If this tracker does not read any cookies then it can be ignored.

epos commented 3 years ago

Thank you @alona-lip for the proposed fix. However when I try your https://github.com/matomo-org/piwik-dotnet-tracker/pull/79 fix for this problem, I still get an HTTP 400 error. The called URL is :

https://piwik.<our domain>.com/piwik.php?idsite=11&rec=1&apiv=1&r=250779&cip=::1&_idts=1611940818&_id=7b2be05759a2bc7d&url=http%3a%2f%2flocalhost%2fdefault.aspx&e_c=mycat3&e_a=myact3

Currently I'm stuck not being able to call the tracking API from .NET. We have Matomo 4.1.0.

alona-lip commented 3 years ago

Hello @epos , Are you sure that your problem has really something common with this PR ?

I did not have 400. I had OutofRange Exception by LoadVisitIdCookies.

These changes should be tested from the Matomo Side (after they fix the CI Build Problem), and should be as an Update to Piwik.Tracker 3.0.0.0 (Nuget-Package) provided.

How did you test it? Have you compiled the changes and made the Nuget-Package by yourself?

alona-lip commented 3 years ago

Hello @tsteur , could you please test this PR as soon as possible and provide the Update to Piwik.Tracker 3.0.0.0 The Update of Piwik.Tracker (.NET) Nuget Package ist critically important for us.

Thanks & Best Regards, Alona

mattab commented 3 years ago

@alona-lip Thank you very much for your Pull request submissions, very appreciated!

I have merged it for now as we have no maintainer currently in the project, have just created a new issue: https://github.com/matomo-org/piwik-dotnet-tracker/issues/80

epos commented 3 years ago

Are you sure that your problem has really something common with this PR ?

Thank you for your answer @alona-lip. The problem was indeed not due to this PR, but I couldn't know this at the time of asking since I was also struggling with the visitor cookie structure change. I isolated that other problem, and created a proper issue :

https://github.com/matomo-org/piwik-dotnet-tracker/issues/81