APIs & Integrations

tomazio
Member

trackEvent not working on react

I'm having trouble getting the event to show on contact's activity feed. The app is a react spa application. I have the tracking script in the html and it's showing a 200 response status code on page load. I have a click listener function that includes the following code:

var _hsq = window._hsq = window._hsq || [];
_hsq.push(["identify", {
email: this.state.email
}]);
_hsq.push(["trackEvent", {
id: "event-id",
}]);

the click listener is working as intended but the event won't show in the activity feed. I have tried it with different event IDs, with values and hard coded emails that match a contact's email but nothing seems to work.

0 Upvotes
7 Replies 7
tomazio
Member

trackEvent not working on react

Btw the events are now triggering correctly. Thank you for your help

0 Upvotes
cbarley
HubSpot Alumni
HubSpot Alumni

trackEvent not working on react

Hi @tomazio, I was just about to respond that I was able to create a test contact with my colleague and was able to successfully see events on their timeline here: https://app.hubspot.com/contacts/1797693/contact/41080402/?interaction=note. Note that we did this on Opera so that IP filtering wouldn't affect behavior. I can also see in your Reports Settings in your portal that there are many IP addresses being filtered, so make sure you aren't testing from a filtered IP address.

0 Upvotes
cbarley
HubSpot Alumni
HubSpot Alumni

trackEvent not working on react

Hi @tomazio, still digging into this one and running some tests. Thanks for your patience.

0 Upvotes
cbarley
HubSpot Alumni
HubSpot Alumni

trackEvent not working on react

Got it, thanks for that @tomazio. Apologies but can I also see the page that you're attempting to track this event on as well? Which button contains the click listener?

0 Upvotes
cbarley
HubSpot Alumni
HubSpot Alumni

trackEvent not working on react

Hey @tomazio, can you send me the following please so I can dig in a bit more?

  1. HubID
  2. A contact that you've attempted to track an event on
  3. a link to the event in hubspot

Thanks!

0 Upvotes
tomazio
Member

trackEvent not working on react

Hey @Connor_Barley and thanks for your reply. I tried to send you a direct message with the information, but it says "Sorry, Connor_Barley is not accepting messages at the moment." Is there a way for me to send the information to you privately eg. email or otherwise?

0 Upvotes
cbarley
HubSpot Alumni
HubSpot Alumni

trackEvent not working on react

Hi @tomazio, the previous information isn't sensitive and nobody can access it if they aren't users in your portal, so you should be fine to post here.

0 Upvotes