Git Product home page Git Product logo

svelte-hubspot's Introduction





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

prop type default description
subdomain string '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
hubId string undefined required; the HupSpot account id
doNotTrack boolean false pass true if you do not want page views to be tracked, e.g. before user consent of GDPR policy
loadChatWidgetImmediately boolean true pass 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

svelte-hubspot's People

Contributors

alexdilley avatar antony avatar ahpercival avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.