Where best to define custom event properties / differentiate between 2 applications data in a project?

  • 2 January 2024
  • 0 replies


We are using Heap across 2 applications and they both send data to the same project because they are on the same subdomain and share user journeys.

I thought it would be a good idea to add event properties to enable us to easily differentiate between the two applications' data by adding the following lines below the install script:


<heap install snippet taken from here>

heap.addEventProperties({application: "name of application"})


However, we are now seeing the occasional "heap.push is not a function error" which looks to occur when "heap.clearEventProperties();" is called. I understand this is likely because Heap has been loaded twice.

That being said, I sense I might be misusing event properties and there might be a better pattern you recommend to achieve differentiating between two applications' data in a single project?


For context, our applications use Rails 7 + Hotwire and we're not using GTM to load Heap. The above code is wrapped in a DOMContentLoaded event listener so that it loads after the deferred scripts have.

This is important because some of Hotwire’s Turbo code needs to load before Heap. Turbo is a module so therefore loads in a deferred manner.

0 replies

Be the first to reply!