donni106 / matomo-tracker-react-native

Stand alone library for using Matomo tracking in React Native and Expo projects.
MIT License
47 stars 15 forks source link

Visit dimension and Action dimension support #19

Open karthik-hr opened 1 year ago

karthik-hr commented 1 year ago

Provide option for Visit Dimension and Action Dimension support

https://github.com/jonkoops/matomo-tracker/tree/main/packages/react#advanced-usage Please checkout customDimensions key and usage in above package

donni106 commented 1 year ago

Hi, if I understand correctly, we should be able to send optional data easily, right? Viewing the API docs, I found dimensions at https://developer.matomo.org/api-reference/tracking-api#optional-user-info.

dimension[1-999] — A Custom Dimension value for a specific Custom Dimension ID 
(requires Matomo 2.15.1 + [Custom Dimensions plugin](https://plugins.matomo.org/CustomDimensions) 
see the [Custom Dimensions guide](https://matomo.org/docs/custom-dimensions/)). 
If Custom Dimension ID is 2 use dimension2=dimensionValue to send a value for this dimension. 
The configured Custom Dimension has to be in scope "Visit".

and at https://developer.matomo.org/api-reference/tracking-api#optional-action-info-measure-page-view-outlink-download-site-search

dimension[0-999] — A Custom Dimension value for a specific Custom Dimension ID 
(requires Matomo 2.15.1 + [Custom Dimensions plugin](https://plugins.matomo.org/CustomDimensions) 
see the [Custom Dimensions guide](https://matomo.org/docs/custom-dimensions/)). 
If Custom Dimension ID is 2 use dimension2=dimensionValue to send a value for this dimension. 
The configured Custom Dimension has to be in scope "Action".

You are already able to send custom user/action info with every action. See the following method for example for tracking actions: https://github.com/donni106/matomo-tracker-react-native/blob/8fdec49c2bf4fc7ee13f7abee034ed1fb5a4b1a4/src/MatomoTracker.js#L64-L78

In the optional userInfo param you can set any value from the API docs. So the following example should work.

trackAction({ name: 'Foo', userInfo: { dimension2: 'Bar' } })

Please give it a try and tell us your experiences.

angelxmoreno commented 1 year ago

@karthik-hr were you able to resolve this?

donni106 commented 4 months ago

@karthik-hr can you give a short update on this please?