Amplitude-TypeScript icon indicating copy to clipboard operation
Amplitude-TypeScript copied to clipboard

Amplitude & Angular - low performance

Open grzegorzKniazuk opened this issue 1 year ago • 2 comments

Expected Behavior

The SDK shouldn't affect the overall performance of the application.

Current Behavior

The performance of our application dropped significantly after adding the Amplitude SDK. For example: just checking a checkbox takes a few seconds on mobile devices. Even the screen scrolling wasn't smooth. We have removed SDK and everything works smoothly now.

Steps to Reproduce

I haven't tried to reproduce this on another Angular project, so for now I'm adding a list of the dependencies we use in the project and class code what we use to integrate Amplitude. We import AmplitudeIntegrationModule directly into AppModule. We call init method on application start using the initializer.

asset1 asset2

Environment

  • JS SDK Version: 2.11.7
  • Installation Method: NPM
  • Browser and Version: Chrome 130

grzegorzKniazuk avatar Oct 21 '24 14:10 grzegorzKniazuk

Hi @grzegorzKniazuk, does the same issue happens when you open the page on a laptop browser? Could you try to turn element interactions off by init(apiKey, {autocapture. elementInteractions: false }) and turn autocapture off by ``init(apiKey, {autocapture: false })` and try again to see if reducing tracking events help?

Mercy811 avatar Oct 22 '24 18:10 Mercy811

No, I think there is no issue on laptop or high-end mobile devices. I have tested app on a few devices. For example: on Samsung S23+ I did not see any performance issues, but I saw it on Samsung A52 (I use mobile Chrome browser).

I have turned off elementInteractions and everything works fine now. Looks like this is the source of the performance drop.

grzegorzKniazuk avatar Oct 23 '24 13:10 grzegorzKniazuk