3.0.0 • Published 7 months ago

@counterscale/tracker v3.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

@counterscale/tracker

Client-side page view tracking library for Counterscale.

For instructions on downloading and deploying the Counterscale server, consult the project README.

Usage

In your browser-based web project:

npm install @counterscale/tracker

Initialize Counterscale with your site ID and deployment URL:

import * as Counterscale from "@counterscale/tracker";

Counterscale.init({
    siteId: "your-unique-site-id",
    deploymentUrl: "https://{subdomain-emitted-during-deploy}.pages.dev/",
});

That's it! Your page views will automatically be tracked and reported to Counterscale.

Advanced

Manually Track Pageviews

Alternatively you can track page view events manually.

To do so, during initialization set autoTrackPageviews to false. Then, you manually call Counterscale.trackPageview() when you want to record a pageview.

import * as Counterscale from "@counterscale/tracker";

Counterscale.init({
    siteId: "your-unique-site-id",
    deploymentUrl: "https://{subdomain-emitted-during-deploy}.pages.dev/",
    autoTrackPageviews: false, // <- don't forget this
});

// ... when a pageview happens
Counterscale.trackPageview();
3.0.0

7 months ago

3.0.0-rc.1

7 months ago

3.0.0-rc.0

7 months ago

3.0.0-beta.2

7 months ago

3.0.0-beta.1

8 months ago

3.0.0-beta.0

8 months ago

3.0.0-alpha.19

8 months ago

3.0.0-alpha.18

8 months ago

2.5.1

9 months ago

2.5.0

9 months ago

2.5.0-beta.2

10 months ago

2.5.0-beta.1

10 months ago