Snippets

Copy-paste code for sending events to Tidings from JavaScript and Python. Anything that speaks HTTP is already integrated — there is no package to install. Two common shapes below; for a helper written to your codebase's house style, hand it to your AI assistant.

Browser

If you are instrumenting a website or a web app, don't write the fetch below — paste one script tag and skip the parts that are tedious to get right: a persistent anonymous id, page views, batching, and linking a visit to the account on sign-in.

index.htmlhtml
<script defer src="https://tidingshq.com/js/v1/tidings.js" data-key="td_your_key"></script>

// then anywhere in your app
tidings.track("signup_completed", { plan: "pro" });

Full reference — identify, reset, options, SPA routing and privacy — in the browser snippet docs.

JavaScript

Works in the browser or Node. Fire-and-forget so it never blocks the caller:

browser or Nodejs
fetch(`${TIDINGS_API}/api/v1/events/`, {
  method: "POST",
  headers: { "X-API-Key": KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ name: "signup_completed", distinct_id: user.id })
});

Python

Pythonpy
import requests

requests.post(
    f"{TIDINGS_API}/api/v1/events/",
    headers={"X-API-Key": KEY},
    json={"name": "report_generated", "distinct_id": user_id},
)