Closed PattaFeuFeu closed 7 years ago
Unfortunately not.
Could write one and we'll add it to the wiki?
At the moment, I don’t have the time to write an article on that matter. But I could write down a few lines underneath this ticket with findings I obtained along the way while updating from 1.0.2 to 2.0.
Update from
compile 'org.piwik.sdk:piwik-sdk:1.0.2'
to
compile 'org.piwik.sdk:piwik-sdk:2.0.0'
TrackHelper moved from org.piwik.sdk
to org.piwik.sdk.extra
--- the new fully qualified name therefore becomes org.piwik.sdk.extra.TrackHelper
Previously, you could add a new tracker by calling Piwik.newTracker(String piwikUrl, int siteId)
.
Now, you need to create a new TrackerConfig which you then supply to the method, like so:
Piwik.newTracker(new TrackerConfig("https://piwik.example.com", "4223", "DEFAULT_TRACKER"));
A createDefault(String piwikUrl, int siteId)
method is available so that no tracker name has to be supplied. This shortens the previous call to:
Piwik.newTracker(TrackerConfig.createDefault("https://piwik.example.com", "4223"));
See: https://github.com/piwik/piwik-sdk-android/pull/157
CustomVariables have been deprecated. See https://github.com/piwik/piwik-sdk-android/pull/148#issuecomment-277723478
Instead of setting a flag on the Piwik instance by calling Piwik.getInstance(this).setDryRun(true)
to enable dry run, you now supply your own list data structure to which the tracking calls are saved instead of being sent.
For example, use: piwikTracker.setDryRunTarget(debugBuild ? new ArrayList<Packet>() : null);
The method for opting out moved from the Piwik
class to the Tracker
class.
Therefore, e.g. piwikTracker.getPiwik().setOptOut(true)
becomes piwikTracker.setOptOut(true)
What happened to setDryRun(boolean)
? I cannot seem to find it.
The dev now sets their list datastructure that the packets during dryrun will be placed into.
I updated my “wiki” comment with all changes I found when updating my codebase. Feel free to add additional pieces of information and also to add my findings to the wiki.
Is there any resource that guides through the changes that occurred during the version upgrade from v1 to v2 of the SDK? Changes like “TrackHelper can now be found under sdk.extra instead of sdk”, “Instead of ‘setOptOut’, please use XY now”, and so on?