Closed derek9gag closed 8 years ago
I see what issue you mean. Isn't that an issue with all methods except maybe the trackScreenView ones? We can't use the URL of the last screen as the Tracker instance might be used by multiple threads.
I would suggest to change the method(s) to require an url argument or take a (optional?) TrackMe and then in another PR consider adding some helper class for this.
@dotsbb You did not start on this yet, right?
I didn't start yet. Feel free to go ahead with this one.
Initial issue fixed by #93 Further SDK API changes in #94 to make this easier for devs in the future.
Thank you!
Referring to
https://github.com/piwik/piwik-sdk-android/blob/master/piwik-sdk/src/main/java/org/piwik/sdk/Tracker.java#L321 and https://github.com/piwik/piwik-sdk-android/blob/master/piwik-sdk/src/main/java/org/piwik/sdk/Tracker.java#L686
The events tracked by Tracker.trackEvent() is likely to be defaulted to "http://HOST/", since trackEvent() does not take URL as argument. This is very likely to be wrong, and this behaviour is inconsistent with Javascript and the iOS SDKs.
We should retain the URL of the last screen view, and use it for all subsequent events. This is implemented in iOS SDK (see https://github.com/piwik/piwik-sdk-ios/blob/0ddb5078f5ed4248bcac424639ff89e5b5c30aa7/PiwikTracker/PiwikTracker.m#L485)