JavaScript API
The snippet already inits and sends a pageview. Use this API when you want custom events, conversions, or a cookie-bar consent choice from your own UI.
Load and init
Most sites only need the tag with data-site. Manual init is the same thing:
<script defer src="https://getpulseanalytics.com/pulse.js"></script>
<script>
pulse.init('YOUR_SITE_KEY')
</script>pulse.init(siteKey, { autoPage: false }) skips the automatic first pageview.
page
pulse.page()
pulse.page({ section: 'pricing' })Manual pageview. Already fired on first load and on history changes.
track
pulse.track('signup')
pulse.track('track_form', { page_url: '/home', form: 'contact' })
pulse.track({ event: 'track_form', page_url: '/home' })Custom event. Keys are snake_case. Both call styles work. Events always land in Pulse. They only fan out to GA4 or HubSpot if you enabled those destinations.
convert
pulse.convert('purchase')
pulse.convert('signup', { plan: 'pro' })Same as track, marked as a conversion in the dashboard.
identify
pulse.identify('you@company.com')
pulse.identify('you@company.com', { name: 'Alex' })Not stored in our anonymous analytics. Used only if a destination (like HubSpot) needs an email. No email → HubSpot identify is skipped.
consent
pulse.consent.set({ analytics: true, marketing: false })
pulse.consent.get()Gates third-party scripts you pasted in Banner & scripts. Our collector still runs after Reject. See Cookie banner.
CORS
You do not set CORS on your server. pulse.js and POST /api/collect live on our origin and allow every customer site. fetch and sendBeacon both work.
