matomo-org / matomo-for-wordpress

Get a fully functioning Matomo Analytics for your WordPress. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Privacy is built-in. 100% data ownership, no one else can see your data. We love Pull Requests!
https://matomo.org
GNU General Public License v3.0
120 stars 25 forks source link

Import possibility for Wordpress Stats by Jetpack #188

Open errotu opened 4 years ago

errotu commented 4 years ago

First of all: Thank you very much for this project! I'm pretty confident that it will enhance the use of Matomo for many Wordpress Admins interested in protecting the privacy of their users.

There's one suggestion I have: I think it would facilitate the migration from currently used analytics tools (such as Wordpress Stats by Jetpack in my example) if an option for an automated import of the currently existing tracking data to Matomo existed.

Are there any chances to implement such a functionality?

tsteur commented 4 years ago

Thanks @errotu

It looks like Jetpack has some API but we'd need to see if we can get any reporting data through this and whether we get raw data from Jetpack which could make things bit easier (raw data meaning the data they recorded for each individual visit like which pages they viewed, what visitorId it was etc). Or whether aggregated data would need to be imported.

We've done the import for aggregated data recently for Google Analytics and it's a multi month project since these things are quite complex. If they provide raw data, this could make things easier.

tsteur commented 4 years ago

@errotu do you maybe know some documentation on whether they provide access to the tracked data?

errotu commented 4 years ago

Unfortunately, I do not have any detailed information. There's one forum post from 2017 referring to this API. Maybe that's worth a shot?

tsteur commented 4 years ago

That's definitely helpful cheers. It looks like we could only import aggregated data nad mostly only import the number of visitors and views.

There are some other metrics like the number of comments, etc. This we could eventually import as events.

Since there is very limited data it might not be that much work to import this data.

tsteur commented 4 years ago

Considering Jetpack has 5M+ active installs and a 7% overall market share it could be quite useful https://w3techs.com/technologies/overview/traffic_analysis

The rest API in https://developer.wordpress.com/docs/api/1.1/get/sites/%24site/stats/ should work for this.

errotu commented 4 years ago

Are there any news on this? I think it would be a great feature!

tsteur commented 4 years ago

@errotu we're currently working heavily on the new Matomo 4 release. We might look into it afterwards

mattmary commented 2 years ago

it's a bit tricky.

there are two ways to export data from jetpack: https://wordpress.org/support/topic/api-to-export-stats-data/#post-15170429

Both of them requires an api_token to authenticate.

This api_token is available from:

all data collected from these two export way are aggregated. it is not possible to get daily data except the number of visits and visitors from the rest api.

tsteur commented 2 years ago

Moving it for now back into backlog. If someone is interested in this feature please comment.

wpgaurav commented 2 years ago

Did this feature get into Matomo?

mattmary commented 2 years ago

Hello @wpgaurav

We have stopped our investigations for now, as there are some technical questions we are not able to answer for now, and the result would be limited. Would you be interested in this feature? Kind regards

Mat

wpgaurav commented 2 years ago

Yes. Even if there is a complicated way to do so, I'd like to know.

edent commented 1 month ago

I'm still interested :-)

Using this API: https://stats.wordpress.com/csv.php?api_key=123456&blog_uri=https://example.com/&table=postviews

I can get back a CSV of

"date",       "post_id", "post_title",  "post_permalink",                   "views"
"2024-10-08", 49835,    "Post 1",       "https://example.com/post/",           19
"2024-10-08" ,42171,    "Another Post", "https://example.com/linux-set-up/",   13
"2024-10-08" ,46727,    "Fun post",     "https://example.com/tatortreiniger/", 12

I can return 500 records at a time and I'm happy looping back through the years.

With a simple CSV like this, is it possible to backfill history into Matomo?

I'm not interested in country of origin, comment counts, referrer etc for the history.

Thanks!

diosmosis commented 1 month ago

With a simple CSV like this, is it possible to backfill history into Matomo?

Yes, but only by writing custom PHP.