I found a defect related to the JavaScript API and dynamic event creation. I want to create the HubSpot events dynamically, instead of creating them in advance on HubSpot side, and use product names from web shop as the event id. Here’s an example of the JavaScript that I’m using:
_hsq.push([“trackEvent”, {
id: “Product X”
}]);
Initially, everything works fine. The HubSpot event is created dynamically and all calls are being captured. However, if the event is deleted then it’s not re-created. Even if you re-create the event manually with the correct name it doesn’t help.
This is actually quite a serious problem for me because I cannot change the event ids and I’ve already deleted certain events that are needed. So hopefully this defect could be fixed. I’ve already contacted support but they said that they are not able to help with JavaScript API related issues.
I found a defect related to the JavaScript API and dynamic event creation. I want to create the HubSpot events dynamically, instead of creating them in advance on HubSpot side, and use product names from web shop as the event id. Here’s an example of the JavaScript that I’m using: _hsq.push([“trackEvent”, { id: “Product X” }]);
Initially, everything works fine. The HubSpot event is created dynamically and all calls are being captured. However, if the event is deleted then it’s not re-created. Even if you re-create the event manually with the correct name it doesn’t help.
This is actually quite a serious problem for me because I cannot change the event ids and I’ve already deleted certain events that are needed. So hopefully this defect could be fixed. I’ve already contacted support but they said that they are not able to help with olansi JavaScript API related issues.
Regards, Jukka
Hi jukka,
Thank for asking i was facing the same issue but after doing a lot of research i was unable to found the best solution. Then i have saw your thread and really get amazed to see the response. And i finally i have sorted my query too with your help. Many Thanks again.
We’ve undeleted the events that seemed to have meaningful names. There were a number with IDs like “null”, “testxx”, etc which we left deleted. If you ID any specific additional items which you want restored, please let us know.
This is a known behavior on our side; the feature was initially designed for the customer base who is configuring and managing these events solely via the UI. We definitely recognize the current behavior is less ideal for the API user, and I’ve passed that feedback on to the analytics team.
If you can share your HubID and the IDs of the events you deleted but still need (feel free to either respond here or DM me), I can have the team manually restore them to get you unblocked.
Thanks! I just sent you the Hub ID via private message.
The HubSpot JS API is slightly limited since you cannot add additional variables to the trackEvent call (like product name or id). Thus, I find the dynamic event creation a really handy feature since then you only need to have one event call defined on the calling application side and the needed variables can be placed to the id field. Managing a large amount of events and event calls manually would be quite tedious.