# Custom Behavioral Events Tracking APIs

**URL:** <https://community.hubspot.com/t/custom-behavioral-events-tracking-apis/42946>\
**Category:** APIs & Integrations\
**Tags:** events\
**Created:** [August 26, 2021, 3:01pm UTC](https://community.hubspot.com/t/custom-behavioral-events-tracking-apis/42946 "2021-08-26T15:01:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![roopeshb](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/roopeshb/32/84335_2.png) [@roopeshb](https://community.hubspot.com/u/roopeshb)\
**Post date:** [August 26, 2021, 3:01pm UTC](https://community.hubspot.com/t/custom-behavioral-events-tracking-apis/42946/1 "2021-08-26T15:01:03Z")

</div>

Hi There,

I’m setting up custom behavioral events for the buttons (e.g. login, profile etc.) in my application and would like to track the event completions and unique visitors on HubSpot.

I’d setup the custom behavioral events using the HubSpot chrome extention. But, it was not accurately capturing the event completions and unqiue visitors. To solve this issue, I explored HubSpot documentation and found the below two topics:

1. [**Tracking Code API**](https://developers.hubspot.com/docs/api/events/tracking-code)
2. [**Custom Behavioral Events API (beta version)**](https://developers.hubspot.com/docs/api/analytics/events)

I integrated these two APIs in the proof of concept and learnt that they both produce the same result. i.e. both of them were successfully capturing the event completions and unique visitors.

Before I integrate either of them on my application, I would like to understand which API is recommended for tracking event completions and unique visitors?

Your answers and suggestions will be helpful to make a sound decision on the solution approach. Thank you!

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [August 27, 2021, 10:00am UTC](https://community.hubspot.com/t/custom-behavioral-events-tracking-apis/42946/2 "2021-08-27T10:00:41Z")

</div>

Hello @roopeshb,

You can use any of those but Custom behavioral events will only be processed for accounts with **Marketing Hub Enterprise**.

And with events API you can track the Custom behavioral events as well.

Hope this helps!

Regards,

---

<div class="post-metadata">

**Author:** ![roopeshb](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/roopeshb/32/84335_2.png) [@roopeshb](https://community.hubspot.com/u/roopeshb)\
**Post date:** [August 27, 2021, 11:46am UTC](https://community.hubspot.com/t/custom-behavioral-events-tracking-apis/42946/3 "2021-08-27T11:46:55Z")

</div>

Hi @himanshurauthan

Thank you for your response. I’ve **Marketing Hub Enterprise** Hubspot account and was wondering which among **[Custom Behavioral Events API](https://developers.hubspot.com/docs/api/analytics/events)** or [**Tracking Code API**](https://developers.hubspot.com/docs/api/events/tracking-code) are recommended by the community?

Regards,

Roopesh

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [August 30, 2021, 7:32am UTC](https://community.hubspot.com/t/custom-behavioral-events-tracking-apis/42946/4 "2021-08-30T07:32:48Z")

</div>

Hello @roopeshb,

As you want **“on button clicks”** I would recommend going with **tracking code API**.

Regards,

---

<div class="post-metadata">

**Author:** ![roopeshb](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/roopeshb/32/84335_2.png) [@roopeshb](https://community.hubspot.com/u/roopeshb)\
**Post date:** [August 30, 2021, 9:04am UTC](https://community.hubspot.com/t/custom-behavioral-events-tracking-apis/42946/5 "2021-08-30T09:04:40Z")

</div>

Hi @himanshurauthan - Thank you!
