Skip to content

Commit 259b76d

Browse files
committed
feat: vanilla docs
1 parent 79ee787 commit 259b76d

File tree

8 files changed

+425
-24
lines changed

8 files changed

+425
-24
lines changed

apps/docs/components/sidebar-content.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ export const contents: SidebarSection[] = [
6767
href: '/docs/sdk',
6868
icon: AtomIcon,
6969
},
70+
{
71+
title: 'Vanilla JavaScript',
72+
href: '/docs/vanilla-js',
73+
icon: FileTextIcon,
74+
},
7075
{
7176
title: 'Node SDK',
7277
href: '/docs/node-sdk',

apps/docs/content/docs/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"getting-started",
1010
"---Implementation---",
1111
"sdk",
12+
"vanilla-js",
1213
"node-sdk",
1314
"api",
1415
"api-keys",

apps/docs/content/docs/sdk.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,27 @@ import { clear } from "@databuddy/sdk";
503503
clear();
504504
```
505505
506+
### Tracking ID Helpers
507+
508+
Get anonymous and session IDs for attribution tracking across redirects:
509+
510+
```javascript
511+
import { getAnonymousId, getSessionId, getTrackingParams } from "@databuddy/sdk";
512+
513+
// Get individual IDs
514+
const anonId = getAnonymousId();
515+
const sessionId = getSessionId();
516+
517+
// Get as URL params string (for redirects)
518+
const trackingParams = getTrackingParams();
519+
const signupUrl = `https://app.databuddy.cc/register?${trackingParams}`;
520+
window.location.href = signupUrl;
521+
```
522+
523+
**Priority order**: URL params → tracker instance → localStorage/sessionStorage
524+
525+
These helpers automatically fall back through multiple sources to find the IDs, perfect for preserving user attribution across signup flows and redirects.
526+
506527
### `flush()`
507528
508529
Force immediate sending of queued events:

0 commit comments

Comments
 (0)