Floating-Dartists / matomo-tracker

A fully cross-platform wrap of the Matomo tracking client for Flutter, using the Matomo API.
https://pub.dev/packages/matomo_tracker
MIT License
26 stars 28 forks source link

Modify url after initialization #119

Closed ahmdt closed 1 year ago

ahmdt commented 1 year ago

Hi, is there a way to modify the url after initialization? China's Firewall slows down the traffic to our default domain and because of that we need a proxy. User can activate the proxy in the app settings.

In the current approach we are calling dispose() but it's still locked with the message "MatomoTracker has already been initialized. You can check the initialize property to see if it has been initialized."

await MatomoTracker.instance.initialize(
  siteId: 11,
  url: 'https://analyctics.com',
);
MatomoTracker.instance.pause();
MatomoTracker.instance.dispose();
await MatomoTracker.instance.initialize(
  siteId: 11,
  url: 'https://china-analyctics.cn',
);
TesteurManiak commented 1 year ago

Unfortunately, it is not possible. This is a feature that will need some investigations as it would imply quite a bit of refactoring to change the url on the fly. We could also consider modifying the dispose method to reset the initialization state.

OgnenDreamix commented 1 year ago

@TesteurManiak any chance that we can publish this as 4.1.0 on pub.dev? Thank you

TesteurManiak commented 1 year ago

Sure! I'll publish it asap.