Skip to main content
If your site has no bundler (plain HTML, Hugo, Jekyll, Webflow, WordPress, or any page without an npm build), load the SDK from cdn.wendung.app instead of installing @wendung/sdk. The script initializes itself from the tag’s data attributes and exposes Wendung as a global, so you can track steps from inline handlers or a plain <script>. The file is the same code as the npm package at that version, built as a self-contained script of about 4 KB compressed.

Setup

1

Add the script tag

Put the tag in <head> on every page you want tracked. Use defer so the SDK runs before your own deferred scripts and before DOMContentLoaded.
Each attribute maps to an init() option:flushInterval and maxBatchSize have no attribute. To set them, omit data-api-key and call Wendung.init() from your own script with the full options object.
Do not use async. An async script can run after the inline code that calls Wendung, and those calls throw [Wendung] Call .init() first.
2

Register the site

With pageview tracking enabled, the SDK records page loads according to the visitor’s consent state. Open Sites in the dashboard and add your hostname so the pageviews show up as visitors, pages, and sources. The web analytics guide covers path rules and the site dashboard.
Pageviews count against your plan’s monthly pageview allowance, separate from events. The free plan has none. See Plans and limits.
3

Track steps and identify users

Wendung is available on window once the script has run. Inline handlers work because they fire after DOMContentLoaded:
Scripts of your own that call Wendung must run after it. Give them defer too (deferred scripts run in document order), or wait for DOMContentLoaded:
Every method from the API reference is available on the global with the same signature.

Versions and caching

The CDN serves three paths for the current release: Use latest to receive every SDK release automatically. Use v0 to stay on the 0.x series, or pin an exact version to control when you update. Both latest and the major channel can change behavior when a new release is published. To use the latest release, change the script’s src:
This example collects aggregate pageviews while pending. Calling Wendung.setConsent('granted') switches to full analytics; calling Wendung.setConsent('denied') stops collection. Use a bare data-track-pageviews attribute if you want to wait for consent before collecting anything. See the consent guide to save and restore the visitor’s choice.

Content Security Policy

If your site sets a CSP, allow the script host and the ingest host:

What differs from the npm package

  • You use the Wendung global instead of import { Wendung } from '@wendung/sdk'. The methods are identical.
  • Initialization happens in the tag. Calling Wendung.init() again afterwards is safe and replaces the configuration, the same as in the package.
  • There are no TypeScript types on the global. If you type-check inline scripts, declare Wendung yourself or move to the package.