Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable default Amplitude destination #950

Closed
huv1k opened this issue Jan 30, 2025 · 4 comments
Closed

Disable default Amplitude destination #950

huv1k opened this issue Jan 30, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@huv1k
Copy link

huv1k commented Jan 30, 2025

Summary

In the old SDK it was possible to disable sending data to Amplitude using middleware. In the current version, it's not possible to disable the default Amplitude destination. For example:

ampli.load({
  client: {
    apiKey: "***"
  },
});

ampli.client.remove("amplitude");

We are using @amplitude/analytics-browser version 2.11.11 and SDK generated with @amplitude/ampli. We could patch it and disable it here

await this.add(new Destination()).promise;
but we would love to skip patching it. Would you be open to somehow disabling programmatically this default destination?

Motivations

We are sending data to Amplitude through Segment because we enhance data with some custom properties that are impossible to access in our frontend code. If we sent it both ways, there would be double the number of events and one without our important custom properties.

@huv1k huv1k added the enhancement New feature or request label Jan 30, 2025
@izaaz
Copy link
Contributor

izaaz commented Jan 30, 2025

@huv1k , if you do ampli.client.remove("amplitude"), does that not work?

@huv1k
Copy link
Author

huv1k commented Jan 30, 2025

@huv1k , if you do ampli.client.remove("amplitude"), does that not work?

Amplitude Logger [Warn]: Plugin with name amplitude does not exist, skipping deregistration and events are still sent.

@Mercy811
Copy link
Contributor

Hi @huv1k, could you try await ampli.load().promise? The default destination is registered on initialization asynchronously. It might be that remove() is executed when the default plugin hasn't been installed yet.

@huv1k
Copy link
Author

huv1k commented Jan 31, 2025

Hi @huv1k, could you try await ampli.load().promise? The default destination is registered on initialization asynchronously. It might be that remove() is executed when the default plugin hasn't been installed yet.

Yes, this works. Thanks it didn't cross my mind that it can be issue 😅 I though it's going to execute faster 🙈

@huv1k huv1k closed this as completed Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants