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

Custom Dimensions in obj-c #225

Closed sofienB closed 6 years ago

sofienB commented 6 years ago

Hi,

I create an app with Objc and Piwik 3.3 (And Android with Piwik 1.0.0). But some client want that my App use Piwik server V3.

So I used Piwik server V3. But Custom Dimensions from all my Apps (iOS and Andorid) doesn't work with this.

For Android I need to past on Java8 but actualy I can't because Java8 doesn't support old Andorid versions. So I work with Java7 and Piwik 1.0.0 (or 2.0.0)

For iOS I can't used swift or use_frameworks! beceause my app is a big SDK and use_frameworks! create problems with some dependences.

I read iOS Piwik source code and I read "Objective-c compatibility extension" and no compatibility for Custom Dimensions ?

have you an idea how can I use custom dimensions in Obj-c project ? With Piwik ios 4.0 with Obj-c, can I ?

brototyp commented 6 years ago

Hi @sofienB,

thanks for your question. I see your issue there. I think you can choose between three solutions.

  1. Patch the old Objective-C SDK, so that it supports custom dimensions.
  2. Import all Matomo SDK source files (all .swift files in the Piwik/MatomoTracker folder) into your project. This would bring the downside of managing updates manually.
  3. Use Carthage to manage the dependency and build a framework that you can simply import into your project.

Let me know if you have more questions.

sofienB commented 6 years ago

Hi @brototyp,

Thanks for your fast answer. I think that the best answer si the first one.

But, do you think that we can used Piwik iOS V3.3 with Piwik Server V3 ?

There are no custom Dimension method with Piwik ios V3.3 ? I try to get values in pewit server. But Piwik ios V3 with server V3 I have no result in all piwik no action no visitor. and no Custom dimension Visit or Custom Dimensions Action.

I used sample code from this git. I change server link and ID.

It works for Piwik iOS V4 with Piwik Server V3.

have you an idea how can I used and configured custom dimension in iOS ? (in your sampleExemple can help me)

thanks,

brototyp commented 6 years ago

Hi @sofienB,

you are welcome. Since the API didn't change from Server v2 to v3 I am pretty sure the older iOS SDK works fine with Server V3.

There is no custom dimension support in the 3.3 version. You will have to add it yourself. Try to use the latest code and check out the example application. I haven't written the old version of the SDK but i would try to put in your server url and site id in the AppDelegate and change the [PiwikTracker sharedInstance].debug = YES; to NO. Also check if you opt-in into tracking. The Example application only tracks if you opt into it. Observe the Log if it still doesn't work.

sofienB commented 6 years ago

Thank you very much,

the issues to get values was coming from App Transport Security. I past arbitrary load to YES.

Now a try to get values for custom dimension or custom variable. Currently, no results.

sofienB commented 6 years ago

Hi @brototyp,

Today I added Custom Dimensions to Ojc-C source code from Piwik iOS V3.3 so, now I can see custom dimensions values from Piwik server V3.

I don't know if it's possible but, I think I can to do a merge request to update matomo-sdk-ios with custom dimension ?

What do you think ?

brototyp commented 6 years ago

Hi @sofienB, awesome. That sounds good. We don't support the older Objective-C SDK anymore and there aren't any patches added to it. But, I would love, if you could reference your fork here so people interested in the same thing can find it?

brototyp commented 6 years ago

I will close this for now. Feel free to post the url to your patched version or reopen if there are any other questions.