1.4.3 • Published 1 year ago

svelte-ackee v1.4.3

Weekly downloads
34
License
MIT
Repository
github
Last release
1 year ago

Svelte module for Ackee

Ackee is a self-hosted analytics tool for those who care about privacy and this module makes it easy to integrate with Svelte/Sapper.

Installation

$ npm install --save svelte-ackee

Usage

With Sapper

Edit the routes/_layout.svelte and add following script:

import { afterUpdate, beforeUpdate } from "svelte";
import { useAckeeSapper } from "svelte-ackee";

export let segment;

const ackeeTracker = useAckeeSapper(
  beforeUpdate,
  afterUpdate,
  {
    server: "https://example.com", // Set to your Ackee instance
    domainId: "hd11f820-68a1-11e6-8047-79c0c2d9bce0", // Set to your domain ID
  },
  {
    ignoreLocalhost: false,
  }
);

See the demo in demos/sapper directory.

With Routify

Edit the App.svelte and add following:

import { useAckeeSvelte } from "svelte-ackee";
import { afterPageLoad } from "@roxi/routify";

const ackeeTracker = useAckeeSvelte(
  $afterPageLoad,
  {
    server: "https://example.com",
    domainId: "hd11f820-68a1-11e6-8047-79c0c2d9bce0",
  },
  {
    ignoreLocalhost: false,
  }
);

See the demo in demos/routify directory.

Accessing underlying ackee-tracker

Both useAckeeSapper and useAckeeSvelte return an ackee-tracker instance so you can call it manually as well:

ackeeTracker.action("513a082c-2cd5-4939-b417-72da2fe1761d", {
  key: "Checkout",
  value: 9.99,
});
1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.9

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago