API Documentation
Integrate Lanorx into your applications using our JavaScript SDK or REST API.
Lanorx SDK
RecommendedInstallation
npm
npm install @lanorx/trackingyarn
yarn add @lanorx/trackingpnpm
pnpm add @lanorx/trackingAutomatic Features:
- Device ID tracking with 30-minute TTL (localStorage)
- Device type detection (mobile, tablet, desktop)
- Referrer tracking (document.referrer)
- User agent collection (navigator.userAgent)
- Page view tracking on initialization
- CONVERSION event creation on email submission
- Email duplicate check (use
hasSubmittedEmail())
Select Your Stack
Integration Example
import { LanorxClient } from '@lanorx/tracking';
import type { ApiResponse, EmailSubmitResponse } from '@lanorx/tracking';
const client: LanorxClient = new LanorxClient({
projectId: 'your_project_id',
apiKey: 'your_api_key'
});
// Check if user has already submitted an email
const status: { submitted: boolean; email?: string } = client.hasSubmittedEmail();
if (status.submitted) {
console.log('Email already submitted:', status.email);
}
// Submit an email (deviceId automatically managed)
// CONVERSION event is automatically created on server
const result: ApiResponse<EmailSubmitResponse> = await client.submitEmail({
email: 'user@example.com'
});
if (result.success) {
console.log('Submitted:', result.data!.email);
}
// Track CTA click
await client.trackCTA('hero'); // section: 'header', 'hero', 'pricing', 'features', etc.Success Response
{
"success": true,
"data": {
"id": "email_abc123",
"email": "user@example.com",
"createdAt": "2025-01-20T10:30:00.000Z"
}
}Error Responses
Invalid email format
{
"error": "Validation error",
"details": [
{
"code": "invalid_string",
"message": "Invalid email format"
}
]
}Project not found
{
"error": "Project not found"
}Email limit reached
{
"error": "Email collection limit reached for this month"
}Get your API key from Settings → API Keys
REST API
AdvancedAuthentication
All API requests require a valid API key in the Authorization header.
Authorization: Bearer lnx_sk_your_api_keyPOST
/api/v1/projects/{projectId}/emailsRequest Body
email (required): Email addressdeviceId (optional): Device identifierdeviceType (optional): Device type (mobile, tablet, desktop)referrer (optional): Referrer URLuserAgent (optional): User agent stringExample
curl -X POST https://www.lanorx.com/api/v1/projects/proj_123/emails \
-H "Authorization: Bearer lnx_sk_..." \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"deviceId": "lanorx_abc123",
"deviceType": "desktop",
"referrer": "https://google.com",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"
}'POST
/api/v1/projects/{projectId}/eventsRequest Body
type (required): Event type (VIEW, CTA, SUBMIT, CONVERSION, NAVIGATE)contentId (optional): A/B Testing variant IDdeviceId (optional): Device identifierdeviceType (optional): Device type (mobile, tablet, desktop)referrer (optional): Referrer URLuserAgent (optional): User agent stringmeta (optional): Additional metadataExamples
# Track page view
curl -X POST https://www.lanorx.com/api/v1/projects/proj_123/events \
-H "Authorization: Bearer lnx_sk_..." \
-H "Content-Type: application/json" \
-d '{
"type": "VIEW",
"deviceId": "lanorx_abc123",
"deviceType": "desktop",
"referrer": "https://google.com",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"
}'
# Track CTA click
curl -X POST https://www.lanorx.com/api/v1/projects/proj_123/events \
-H "Authorization: Bearer lnx_sk_..." \
-H "Content-Type: application/json" \
-d '{
"type": "CTA",
"deviceId": "lanorx_abc123",
"deviceType": "mobile",
"referrer": "https://twitter.com",
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X)",
"meta": {"section": "hero"}
}'
# Track submit
curl -X POST https://www.lanorx.com/api/v1/projects/proj_123/events \
-H "Authorization: Bearer lnx_sk_..." \
-H "Content-Type: application/json" \
-d '{
"type": "SUBMIT",
"deviceId": "lanorx_abc123",
"deviceType": "tablet",
"referrer": "https://facebook.com",
"userAgent": "Mozilla/5.0 (iPad; CPU OS 14_0 like Mac OS X)"
}'API Access
| Plan | API Access |
|---|---|
| FREE | Not available |
| STARTER | Not available |
| PRO | Unlimited |
| ENTERPRISE | Unlimited |
No rate limits for PRO and ENTERPRISE plans.
Need Help?
Questions about integration? We are here to help.