Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.datalyr.com/llms.txt

Use this file to discover all available pages before exploring further.

DATALYR provides SDKs for all major platforms, enabling you to track user behavior and conversions across web browsers, server-side applications, and mobile apps.

What It Does

Track Events Everywhere:
  • Web SDK for browser tracking
  • Server SDK (Node.js) for backend events
  • iOS SDK for native Apple apps
  • React Native SDK for cross-platform mobile apps
  • Consistent API across all platforms
  • Automatic identity resolution across devices

Available SDKs

Web SDK (JavaScript)

Best For:
  • Website tracking
  • Single-page applications (SPAs)
  • Client-side event tracking
  • Attribution tracking
  • Session management
Features:
  • Automatic pageview tracking
  • Custom event tracking
  • User identification
  • Attribution capture
  • Fingerprinting
  • Cookie management
  • Container/tag manager support
Installation:
npm install @datalyr/web
Or use a script tag for sites without a build system:
<script defer src="https://track.datalyr.com/dl.js"
  data-workspace-id="your_workspace_id">
</script>
See Web SDK for full documentation.

Server SDK (Node.js)

Best For:
  • Backend event tracking
  • Server-side conversions
  • Webhook processing
  • API integrations
  • Bulk data imports
Features:
  • Server-side event tracking
  • Identity resolution
  • Event batching
  • Automatic retries
  • Offline queue
  • TypeScript support
Installation:
npm install @datalyr/api
Example:
const Datalyr = require('@datalyr/api');
const datalyr = new Datalyr('dk_your_api_key');

await datalyr.track({
  event: 'purchase',
  userId: 'user_123',
  properties: { revenue: 99.99, currency: 'USD' }
});
See Server SDK for full documentation.

iOS SDK (Swift)

Best For:
  • Native iOS apps
  • iPad apps
  • App Store attribution
  • SKAdNetwork integration
Features:
  • Native Swift API
  • App lifecycle tracking
  • Attribution tracking
  • SKAdNetwork support
  • Session management
  • Offline queue
  • Third-party integration helpers (getSuperwallAttributes(), getRevenueCatAttributes())
Installation:
// Swift Package Manager
dependencies: [
  .package(url: "https://github.com/datalyr/swift", from: "2.1.3")
]
Example:
import DatalyrSDK

try await DatalyrSDK.shared.initialize(config: DatalyrConfig(
  workspaceId: "your_workspace_id",
  apiKey: "dk_your_api_key"
))

await DatalyrSDK.shared.track("purchase", eventData: [
  "revenue": 99.99,
  "currency": "USD"
])
See Mobile SDKs for full documentation.

React Native SDK

Best For:
  • Cross-platform mobile apps (iOS + Android)
  • React Native projects
  • Expo apps
Features:
  • Works on both iOS and Android
  • React Native hooks support
  • Attribution tracking
  • Session management
  • Offline queue
  • TypeScript support
  • Third-party integration helpers (getSuperwallAttributes(), getRevenueCatAttributes())
Installation:
npm install @datalyr/react-native
Example:
import { Datalyr } from '@datalyr/react-native';

await Datalyr.initialize({
  workspaceId: 'your_workspace_id',
  apiKey: 'dk_your_api_key'
});

await Datalyr.track('purchase', {
  revenue: 99.99,
  currency: 'USD'
});
See Mobile SDKs for full documentation.

Public API

Best For:
  • Read-only access to analytics data
  • Building custom dashboards
  • AI-powered data queries
  • Programmatic reporting
Features:
  • 14 REST endpoints covering all analytics data
  • Authenticate with SDK key (dk_) or Agent key (dk_agent_)
  • 100 requests/minute rate limit
  • JSON responses
Base URL:
https://app.datalyr.com/api/v1
See Public API for full documentation.

Choosing the Right SDK

Use Web SDK when:
  • Tracking website visitors
  • Building web applications
  • Need browser attribution data
  • Want automatic pageview tracking
Use Server SDK when:
  • Processing backend events
  • Tracking server-side conversions
  • Building webhooks or APIs
  • Need secure API key tracking
Use iOS SDK when:
  • Building native iOS apps
  • Need SKAdNetwork integration
  • Want App Store attribution
  • Require native performance
Use React Native SDK when:
  • Building cross-platform apps
  • Using React Native framework
  • Need both iOS and Android support
  • Want single codebase

Common Features

All SDKs Include:
  • Event tracking with custom properties
  • User identification
  • Anonymous visitor tracking
  • Session management
  • Event batching and queue
  • Automatic retries
  • Offline support
  • Debug mode
Identity Resolution: All SDKs use consistent identity fields (anonymousId, userId, visitorId) to link users across platforms and devices. Event Format: Events tracked from any SDK appear identically in DATALYR dashboard with platform-specific metadata.

Authentication

Web SDK: Uses workspaceId (public identifier from tracking script) Server/Mobile SDKs: Require apiKey (secret key from Settings → API Keys) Keep API keys secure - never expose in client-side code.

Getting Started

Quick Start:
  1. Choose SDK for your platform
  2. Install via npm/Swift Package Manager
  3. Initialize with workspace ID or API key
  4. Track your first event
  5. Verify in Event Stream
Best Practices:
  • Use Web SDK for browser tracking
  • Use Server SDK for backend events
  • Use Mobile SDKs for apps
  • Combine SDKs for full-stack tracking
  • Track same user across platforms with identify()

Event Limits

All tracked events count toward your plan limits regardless of SDK used. See Pricing for event limits.

Support

SDK Issues: Example Code: Each SDK includes example projects showing common implementations.

Next Steps

Web SDK

Browser tracking guide

Server SDK

Backend tracking guide

Mobile SDKs

iOS & React Native guide

Advanced Topics

Identity, batching, plugins

Public API

REST API for analytics data