Await trackEvent | Community
Skip to main content
Answered

Await trackEvent

  • May 8, 2023
  • 2 replies
  • 201 views

Hi, is there any way to wait until window.Intercom(‘trackEvent’) finishes? 

I’m tracking user’s logout event then use Intercom(‘shutdown’) to clean up the cookies and reset Intercom, but it always throws this error:

Uncaught TypeError: Cannot read properties of undefined (reading 'then')
    at frame-modern.422879eb.js:1:381486

Best answer by Jacob Cox

Hi @tuanna1601 !

 

Any solution would be written by you outside of the Intercom product, itself. That said, I would think you would be able to use an async/await call wouldn’t you?

Have you tried that, yet?

2 replies

Jacob Cox
Intercom Team
Forum|alt.badge.img+5
  • Sr. Technical Support Engineer
  • Answer
  • May 13, 2023

Hi @tuanna1601 !

 

Any solution would be written by you outside of the Intercom product, itself. That said, I would think you would be able to use an async/await call wouldn’t you?

Have you tried that, yet?


  • Author
  • New Participant
  • May 16, 2023

Hi @tuanna1601 !

 

Any solution would be written by you outside of the Intercom product, itself. That said, I would think you would be able to use an async/await call wouldn’t you?

Have you tried that, yet?

Yes, I did try that, but after looking at the source code from intercom, window.Intercom(‘trackEvent’) doesn’t return a Promise, which I need to await on.