matomo-org / matomo-sdk-ios

Matomo iOS, tvOS and macOS SDK: a Matomo tracker written in Swift
MIT License
390 stars 164 forks source link

Let users track Custom Dimensions #82

Closed tsteur closed 7 years ago

tsteur commented 8 years ago

In https://github.com/piwik/piwik/issues/9129 we created a new plugin to track Custom Dimensions.

To the JavaScript Tracker we added a new method setCustomDimension(int dimensionId, string dimensionValue). This sets a tracking API parameter dimension$dimensionId=$dimensionValue. Eg dimension1=foo or dimension2=bar. So the tracking API parameter starts with dimension followed by the set dimensionId.

I reckon we should be consistent here with the PHP Tracker and clear all set custom dimensions after the next tracking request was sent. eg

setCustomDimension(1, 'myvalue1')
setCustomDimension(2, 'myvalue2)
trackPageview()
// now dimension 1 and 2 would be cleared and one has to set values again

FYI: Custom Dimensions are similar to Custom Variables. Currently a plugin is needed to use them but in Piwik 3.0 it will be installed by default and at some point we will deprecate Custom Variables (not soon though)

tsteur commented 8 years ago

BTW: In PHP-Tracker we used a more generic implementation see: https://github.com/piwik/piwik-php-tracker/pull/15/files

It's basically a method setCustomTrackingParameter(parameter, value) that let's you set a dimension like this: setCustomTrackingParameter('dimension1', 'my value'). Also in the future it will let you set any custom tracking parameter for any custom plugin.

tobz67 commented 8 years ago

Curious as to the status of custom dimensions for the iOS SDK. The documentation recommends using dimensions over custom variables however this is still listed as an enhancement for the iOS library.

Trying to decide the right path for some additional event tracking meta data. Thank you!

mattab commented 8 years ago

Hi @tobz67

Maybe you are able to help us here? we would welcome a pull request to add the setCustomTrackingParameter method in the iOS SDK. In general, we welcome your help to maintain and improve our iOS SDK!

mattab commented 8 years ago

FYI: we the Piwik team are looking for a maintainer for the iOS SDK. if you can help please comment here #91 - we need you!

brototyp commented 7 years ago

There is an open pull request on Custom Dimension tracking. Please add your thoughts.