Hi community,
I’ve been trying to implement Heap on my next.js website. Adding the <script> tags was straightforward and clicks and views are tracking without any issues.
However, I’d like to track some custom events using the heap.track() and use the heap.addUserProperties() APIs. I’ve been trying many different approaches, but can’t figure out an elegant way to do it. Is there a way to access the window.heap API I initialise in the <script> tags from the methods in my client components?
I tried to look into the url below too, but wasn’t able to apply it to a next.js configuration.
I prefer not to use the server side REST API since I want to include the session data.
Thanks in advance for any help!
Best regards,
Tobi