0.1.2 • Published 6 years ago
analytics-plugin-hubspot v0.1.2
HubSpot plugin for analytics
Note: This package has moved to @analytics/hubspot
Integration with HubSpot for analytics
Usage
Install analytics and @analytics/hubspot packages
npm install analytics @analytics/hubspotImport and initialize in project
import Analytics from 'analytics'
import hubSpotPlugin from '@analytics/hubspot'
const analytics = Analytics({
app: 'awesome-app',
plugins: [
hubSpotPlugin({
portalId: '234576'
})
]
})
/* Track page views */
analytics.page()
/* Track custom events */
analytics.track('buttonClicked')
/* Identify visitors */
analytics.identify('user-xzy-123', {
email: 'bill@murray.com',
accountLevel: 'pro'
})Using identify
Important: HubSpot requires an email field for making identify calls.
If your identify call does not contain email HubSpot will not be notified of the new user.
When sending properties with identify calls, all camelCase traits are automatically converted to snake_case. There is one exception to this for firstName & lastName which are sent as firstname & lastname.
Example:
analytics.identify('user-xzy-123', {
email: 'bill@murray.com',
accountLevel: 'pro' // trait will be `account_level`
})Configuration
Plugin Options
Arguments
- pluginConfig object - Plugin settings
- pluginConfig.portalId string - The HubSpot Portal (or Hub) Id of your HubSpot account
Example
hubSpotPlugin({
portalId: '234576'
})