APIs & Integrations

Pooja1
Member

Problem with Javascript API custom event

Hi,
I am trying to create a custom event using java script API to get the click on a HTML element
here is code
$("#block-menu-menu-footer").on("click", function() {
hsq.push(["trackEvent", {
id: "000005553072",
value: "clicked footer"
}]);

});

But I was not able to see any activity log for this event. I am kind of new to the custom event , so any help will be appreciated .

0 Upvotes
3 Replies 3
Pooja1
Member

Problem with Javascript API custom event

Thanks for the reply Derek,
I did tried both options without the value and with the value set to numerical value, but not able to see anything under the activity log .
I also tried creating a clicked element event and that is working fine.- I can see the results in activity log.
I am not sure what I am doing wrong with custom event.
Please suggest.

0 Upvotes
shai
Member

Problem with Javascript API custom event

Should hsq be _hsq (or window._hsq)?

It should also possibly be preceded by window._hsq = window._hsq || [], for the cases where it's clicked before the HubSpot Tracking API has loaded.

Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Problem with Javascript API custom event

Hi @Pooja,

The value field is used to track the revenue of an event, and has to be a numerical value. It isn't the label of the event, and having it set to a text value might be messing with things. You can set the id field to the text you'd like to see instead. Can you try without the value or with the value set to a numerical value?

0 Upvotes