HubSpot plugin for
Integration with HubSpot for analytics
This analytics plugin will load HubSpot's client side tracking script into your application and send custom events, page views, and identify visitors inside HubSpot.
Click to expand
npm install analyticsnpm install @analytics/hubspot
How to use
Below is an example of how to use the browser plugin.
const analytics =/* Track a page view */analytics/* Track a custom event */analytics/* Identify a visitor */analytics
See additional implementation examples for more details on using in your project.
The HubSpot client side browser plugin works with these analytic api methods:
- analytics.identify - Identify visitors and send details to HubSpot
- analytics.page - Sends page views into HubSpot
- analytics.track - Track custom events and send to HubSpot
const analytics =
stringThe HubSpot Portal (or Hub) Id of your HubSpot account
@analytics/hubspot package works in the browser
Below are additional implementation examples.
Using in HTML
Below is an example of importing via the unpkg CDN. Please note this will pull in the latest version of the package.
Using @analytics/hubspot in HTML....
Using in HTML via ES Modules
@analytics/hubspot in ESM modules.
Using @analytics/hubspot in HTML via ESModules....
Important: HubSpot requires an
If your identify call does not contain
When sending properties with
identify calls, all
camelCase traits are automatically converted to
snake_case. There is one exception to this for
lastName which are sent as