Skip to content
Discussion options

You must be logged in to vote

I figured it out.

First, you can create a method which will generate a new instance of MatomoTracker:

Future<MatomoTracker> createTracker(int siteId, String url) async {
  MatomoTracker tracker = MatomoTracker();
  await tracker.initialize(siteId: siteId, url: url);
  return tracker;
}

Next, whenever you want to change siteId and url, just call the createTracker function with the new siteId and url:

// Initialize a tracker for siteId 1
MatomoTracker tracker = await createTracker(1, 'https://my-website-1.com');

// ... Do tracking for siteId 1 ...

// Create a new tracker for siteId 2
tracker = await createTracker(2, 'https://my-website-2.com');

// Now the tracker is set up for siteId 2

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by carlosfarfangalindoNL222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant