Skip to main content
These pages describe the public surface of @grainql/tag 4.5.1 and @grainql/analytics-web 3.4.2. Every signature is copied from the .d.ts files that ship inside the published packages. When a sentence on this site disagrees with those files, the .d.ts files win.

The two packages

The script build of Grain Tag at https://tag.grainql.com/v4/your-tenant-id.js exposes the same functions on window.GrainTag.

Import forms

@grainql/tag has no side effects at import time. Outside a browser, init returns a no-op stub, so a server-rendered application does not need an environment guard.

Reference pages

Return values

A Grain Tag track call does not return a promise. The event goes into a queue and the transport sends the queue later. To wait for delivery, call flush. An Analytics Web track call is fire-and-forget. A delivery failure does not reject the promise. The client logs the failure when debug is true, and retries the request retryAttempts times. The configuration methods return the cached value or the default on a failure. The Async methods throw, so wrap them in try and catch. Read Errors and retries.