matomo-tracker-react-native icon indicating copy to clipboard operation
matomo-tracker-react-native copied to clipboard

Visit dimension and Action dimension support

Open karthik-hr opened this issue 1 year ago • 3 comments

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

karthik-hr avatar Jun 22 '23 19:06 karthik-hr

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.

donni106 avatar Jun 23 '23 08:06 donni106

@karthik-hr were you able to resolve this?

angelxmoreno avatar Nov 12 '23 21:11 angelxmoreno