0.5.0 • Published 3 years ago

@beyonk/svelte-hubspot v0.5.0

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Svelte HubSpot

js-standard-style Svelte v3

Svelte HubSpot integration

Installation

npm i -D @beyonk/svelte-hubspot

Usage

<!-- src/routes/__layout.svelte -->
<HubSpotTracking hubId="123456" />

<script>
  import { HubSpotTracking } from '@beyonk/svelte-hubspot'
</script>

Properties

proptypedefaultdescription
subdomainstring'js'HubSpot tracking code may be served via region-specific CDN, denoted by the subdomain of hs-scripts.com – this specific asset must be used
hubIdstringundefinedrequired; the HupSpot account id
doNotTrackbooleanfalsepass true if you do not want page views to be tracked, e.g. before user consent of GDPR policy
loadChatWidgetImmediatelybooleantruepass false if you don't want the chat widget (where applicable) to be implicitly loaded — use loadChatWidget() to explicitly initialise chat

(See demo code for example usage.)

Tracking code API

The component instance exposes an interface to allow you to push actions to the HubSpot tracking queue. Note that you should still push the current path and submit identify calls before the tracking code is loaded (if at all); on load, an initial trackPageView is implicitly made to process items already in the queue.

Check out the example code to see how the current page could be tracked in a SvelteKit/Sapper app.

Developing

In order to run the local demo you must pass a valid HubSpot ID otherwise it won't work:

VITE_HUB_ID=<your-hub-id> npm run dev
0.5.0

3 years ago

0.4.1

4 years ago

0.3.0

4 years ago

0.4.0

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago