matomo-nodejs-tracker icon indicating copy to clipboard operation
matomo-nodejs-tracker copied to clipboard

use for React Native App tracking

Open gasolin opened this issue 5 years ago • 2 comments

I found matomo support tracking http API and provided the js client https://developer.matomo.org/api-reference/tracking-api

Instead of use https://github.com/BonifyByForteil/react-native-matomo which requires some Android/iOS SDK dependencies (not possible to do so with managed Expo environment), could I use matomo-nodejs-tracker for React Native App tracking?

gasolin avatar May 16 '19 03:05 gasolin

Checked the source and found the matomo-nodejs-tracker use some nodejs API, its not possible to reuse it directly for RN mobile app.

https://github.com/matomo-org/matomo-nodejs-tracker/blob/master/index.js

But I think its possible to wrap node specific API with the frontend-compatible API, to make it work in both environment, like replace:

  • request to fetch/axios,
  • query-string to https://www.npmjs.com/package/query-string
  • url-parse to https://www.npmjs.com/package/url-parse
  • EventEmitter to https://www.npmjs.com/package/eventemitter3 / https://www.npmjs.com/package/events
  • util.inherits to https://www.npmjs.com/package/inherits

gasolin avatar May 16 '19 04:05 gasolin

I have started a package to be able to track from Expo project: https://github.com/donni106/matomo-tracker-react-native

A very first integration works with manually firing the tracking of actions.

Feel free to use it and create feature requests.

donni106 avatar Oct 21 '20 12:10 donni106