piwik/piwik-sdk-ios — pull request #41 by gpalouk (2014-08-08 10:54:22+00:00)
Title: New feature: Extra Visitor Custom Variables which can be updated per event.

PiwikTracker for iOS supports Visitor Custom Variables which are created on each new app session, they are regarding tracking of iOS device, iOS platform version and app's version as well. The main drawback is that the developer has no option to change those custom variables through PiwikTracker library methods because they are "hardcoded" in library code.

The new feature, I has added, permits the set of custom variables programmatically while preserves the PiwikTracker's library reserved ones. Additionally, those extra custom variables can be updated on every send view, send event etc "action" and not only on new session as the PiwikTracker's reserved / hardcoded custom variables do.

You can set, get and remove an extra custom variable at specific index with the respective newly implemented methods. Constant:

static NSUInteger const PiwikCustomVariablesNumberOfReserved = 3;

declares the number of reserved custom variables that PiwikTracker uses (currently is 3). Also, I assume that the max number of custom variables is 5, so with 3 reserved, only two extra custom variables can be defined (at indexes: 4 and 5). If you change the above constant of the reserved custom variables, methods are flexible enough so you can set extra custom variables at all available indexes up to 5.

Enjoy!