Documentation
Everything you need to install, configure, and use Lynq Studio — for websites, web apps, and mobile apps.
Quick Start
Get Lynq running on your website or app in under 2 minutes.
Create an account
Sign up at lynq.studio/signup and add your website or app.
Install the tracking code
Add this snippet before the closing </head> tag:
<script src="https://YOUR_ENDPOINT/t/lynq.js"
data-website-id="YOUR_WEBSITE_ID"
data-endpoint="https://YOUR_ENDPOINT/api/collect">
</script>Replace YOUR_ENDPOINT and YOUR_WEBSITE_ID with values from your dashboard settings.
See data in real-time
Open your dashboard. Data will appear within seconds of the first visit.
Installation Methods
HTML (Standard)
Paste this in your HTML <head>:
<script src="https://YOUR_ENDPOINT/t/lynq.js"
data-website-id="lq_xxxxxxxxxxxx"
data-endpoint="https://YOUR_ENDPOINT/api/collect">
</script>Google Tag Manager
Create a new Custom HTML tag:
<script>
(function(){
var s = document.createElement('script');
s.src = 'https://YOUR_ENDPOINT/t/lynq.js';
s.dataset.websiteId = 'lq_xxxxxxxxxxxx';
s.dataset.endpoint = 'https://YOUR_ENDPOINT/api/collect';
document.head.appendChild(s);
})();
</script>Set the trigger to All Pages — Page View.
Next.js / React
// app/layout.tsx or _app.tsx
import Script from 'next/script';
export default function Layout({ children }) {
return (
<html>
<head>
<Script
src="https://YOUR_ENDPOINT/t/lynq.js"
data-website-id="lq_xxxxxxxxxxxx"
data-endpoint="https://YOUR_ENDPOINT/api/collect"
strategy="afterInteractive"
/>
</head>
<body>{children}</body>
</html>
);
}WordPress
Add to your theme's functions.php:
function lynq_tracking() {
echo '<script src="https://YOUR_ENDPOINT/t/lynq.js"
data-website-id="lq_xxxxxxxxxxxx"
data-endpoint="https://YOUR_ENDPOINT/api/collect"></script>';
}
add_action('wp_head', 'lynq_tracking');Shopify
Go to Online Store → Themes → Edit code → theme.liquid and paste the HTML snippet before </head>.
Event Tracking
Lynq automatically tracks page views and sessions. For custom events, use the global lynq() function.
Basic Event
lynq('track', 'button_click', {
button_name: 'Sign Up',
page: '/pricing'
});Event Parameters
| Parameter | Type | Description |
|---|---|---|
| event_type | string | Required. Name of the event. |
| params | object | Optional. Key-value pairs. Max 20 params per event. |
| value | number | Optional. Numeric value (e.g., revenue). |
| currency | string | Optional. ISO currency code (e.g., "TRY", "USD"). |
Common Events
// Form submission
lynq('track', 'form_submit', { form_name: 'Newsletter' });
// Video play
lynq('track', 'video_play', { video_title: 'Product Demo', duration: 120 });
// File download
lynq('track', 'file_download', { file_name: 'whitepaper.pdf' });
// Search
lynq('track', 'search', { search_term: 'analytics', results_count: 12 });
// Login
lynq('track', 'login', { method: 'google' });E-Commerce Tracking
Track the full purchase funnel: product views, cart actions, and purchases.
Product View
lynq('track', 'view_item', {
item_id: 'SKU-12345',
item_name: 'Wireless Headphones',
item_brand: 'AudioTech',
item_category: 'Electronics',
price: 299.99,
currency: 'TRY'
});Add to Cart
lynq('track', 'add_to_cart', {
item_id: 'SKU-12345',
item_name: 'Wireless Headphones',
quantity: 1,
price: 299.99,
currency: 'TRY'
});Purchase
lynq('track', 'purchase', {
transaction_id: 'T-98765',
items: [
{ item_id: 'SKU-12345', item_name: 'Wireless Headphones', quantity: 1, price: 299.99 },
{ item_id: 'SKU-67890', item_name: 'Phone Case', quantity: 2, price: 49.99 }
],
value: 399.97,
currency: 'TRY',
shipping: 15.00,
tax: 72.00
});Full Funnel Events
| Event | When to fire |
|---|---|
| view_item_list | User views a product category / search results |
| view_item | User views a product detail page |
| add_to_cart | User adds a product to cart |
| remove_from_cart | User removes a product from cart |
| begin_checkout | User starts the checkout flow |
| add_payment_info | User submits payment information |
| purchase | Transaction completes successfully |
Attribution Model
Lynq uses a last external touch attribution model. Here's how it works:
When a visitor arrives with UTM parameters, those are stored in a first-party cookie (_lynq_attr) with a 90-day lifetime.
If the visitor returns via a different paid or organic channel, the cookie is updated with the new source (last external touch).
If the visitor returns directly (no referrer), the previous attribution is preserved. Direct visits do not overwrite campaign data.
Campaign attribution expires after 30 days of no external touch. After expiry, the visitor is classified as "direct / returning".
UTM Parameters
| Parameter | Example | Usage |
|---|---|---|
| utm_source | Traffic source | |
| utm_medium | cpc | Marketing medium |
| utm_campaign | summer_sale | Campaign name |
| utm_term | analytics+tool | Paid keyword |
| utm_content | banner_v2 | Ad variation |
Referrer Classification
When a visitor arrives without UTMs, Lynq classifies the source from the referrer domain:
| Referrer contains | Source / Medium |
|---|---|
| google.com, google.com.tr | Google / organic |
| instagram.com, l.instagram.com | Instagram / social |
| facebook.com, l.facebook.com | Facebook / social |
| t.co, twitter.com, x.com | Twitter / social |
| linkedin.com | LinkedIn / social |
| Other external domain | domain.com / referral |
API Reference
All API endpoints require authentication via JWT Bearer token or Admin API key.
Authentication
# Option 1: JWT Bearer token
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
https://YOUR_ENDPOINT/api/admin/report/pages
# Option 2: Admin API key
curl -H "X-Admin-Key: YOUR_ADMIN_KEY" \
https://YOUR_ENDPOINT/api/admin/report/pagesReport Endpoints
/api/admin/report/pages/api/admin/report/sources/api/admin/report/devices/api/admin/report/geography/api/admin/report/ecommerce/api/admin/report/events/api/admin/report/campaigns/api/admin/report/journey/api/admin/liveQuery Parameters
| Param | Example | Description |
|---|---|---|
| hours | 168 | Relative time range (last N hours) |
| from | 2026-02-01 | Start date (YYYY-MM-DD) |
| to | 2026-02-10 | End date (YYYY-MM-DD) |
| websiteId | lq_xxxx | Filter by website |
Data Collection Endpoint
POST /api/collect
Content-Type: application/json
{
"website_id": "lq_xxxxxxxxxxxx",
"event_type": "page_view",
"url": "https://example.com/products",
"title": "Products — Example Store",
"referrer": "https://google.com",
"screen_resolution": "1920x1080",
"language": "en-US",
"params": {}
}Export Endpoint
# Export pages report as CSV
GET /api/export/pages?hours=168&format=csv
# Export sources report as JSON
GET /api/export/sources?from=2026-02-01&to=2026-02-10&format=jsonJavaScript SDK (App Tracking)
For React Native, Electron, or Node.js applications.
Installation
npm install @lynq/trackerUsage
import { LynqTracker } from '@lynq/tracker';
const tracker = new LynqTracker({
websiteId: 'lq_xxxxxxxxxxxx',
endpoint: 'https://YOUR_ENDPOINT/api/collect'
});
// Track screen view
tracker.screenView('HomeScreen');
// Track custom event
tracker.track('button_click', { button: 'Buy Now' });
// Track purchase
tracker.purchase('TXN-123', 299.99, 'TRY', [
{ item_id: 'SKU-1', item_name: 'Product', quantity: 1, price: 299.99 }
]);iOS SDK (Swift)
Installation
Add via Swift Package Manager:
https://github.com/lynq-studio/lynq-ios.gitUsage
import LynqTracker
// Initialize in AppDelegate
LynqTracker.shared.configure(
websiteId: "lq_xxxxxxxxxxxx",
endpoint: "https://YOUR_ENDPOINT/api/collect"
)
// Track screen view
LynqTracker.shared.screenView("HomeViewController")
// Track event
LynqTracker.shared.track("add_to_cart", params: [
"item_id": "SKU-123",
"price": 299.99
])
// Track purchase
LynqTracker.shared.purchase(
transactionId: "TXN-456",
revenue: 299.99,
currency: "TRY",
items: [["item_id": "SKU-123", "item_name": "Product"]]
)Android SDK (Kotlin)
Installation
// build.gradle
implementation 'studio.lynq:tracker:1.0.0'Usage
import studio.lynq.LynqTracker
// Initialize in Application.onCreate()
LynqTracker.init(
context = this,
websiteId = "lq_xxxxxxxxxxxx",
endpoint = "https://YOUR_ENDPOINT/api/collect"
)
// Track screen view
LynqTracker.screenView("HomeActivity")
// Track event
LynqTracker.track("add_to_cart", mapOf(
"item_id" to "SKU-123",
"price" to 299.99
))
// Track purchase
LynqTracker.purchase(
transactionId = "TXN-789",
revenue = 299.99,
currency = "TRY",
items = listOf(mapOf("item_id" to "SKU-123"))
)Flutter SDK (Dart)
Installation
# pubspec.yaml
dependencies:
lynq_tracker: ^1.0.0Usage
import 'package:lynq_tracker/lynq_tracker.dart';
// Initialize
final tracker = LynqTracker(
websiteId: 'lq_xxxxxxxxxxxx',
endpoint: 'https://YOUR_ENDPOINT/api/collect',
);
await tracker.init();
// Track screen view
await tracker.screenView('HomeScreen');
// Track event
await tracker.track('add_to_cart', params: {
'item_id': 'SKU-123',
'price': 299.99,
});
// Track purchase
await tracker.purchase(
transactionId: 'TXN-012',
revenue: 299.99,
currency: 'TRY',
items: [{'item_id': 'SKU-123', 'item_name': 'Product'}],
);Dashboard Guide
Your dashboard is organized into focused report pages:
Overview
KPIs, traffic trend, top pages, top sources at a glance.
Pages
All pages, entry pages, exit pages with views, visitors, and sessions.
Sources
Traffic sources with medium, sessions, purchases, revenue, and conversion rate.
Campaigns
UTM campaign performance with sortable metrics and medium filter.
Devices
Browser, OS, screen size, and language breakdowns with visual bars.
Geography
Country and city distribution with flag indicators and drill-down.
E-Commerce
Revenue KPIs, conversion funnel, product performance table.
Events
All event types with counts, users, and values. Filterable by type.
User Journey
Select any user and view their complete event timeline across sessions.
Cohort
Weekly cohort matrix showing user retention over time.
Retention
Daily and weekly retention curves with period-over-period comparison.
Real-time
Live visitors, active pages, and geographic distribution.
Filtering
Every report supports advanced filtering. Click the filter icon and select:
- Field — what to filter (URL, source, country, etc.)
- Operator — how to match (contains, equals, starts with, greater than, etc.)
- Value — what to match against
Multiple filters can be combined. Active filters appear as chips that can be removed individually.
Date Ranges
Use the date picker in the header. Presets available:
- Today, Yesterday, Last 7 / 14 / 28 / 90 days
- Custom range (select start and end dates on the calendar)
Export
Every report has an export button. Click it to download the current data as a CSV file for use in spreadsheets or BI tools.
Privacy & GDPR
Lynq Studio is built with privacy at its core.
What makes Lynq privacy-friendly?
- ✓ No personal data collected from visitors
- ✓ IP addresses hashed with daily-rotating salt, never stored
- ✓ First-party cookies only (no cross-site tracking)
- ✓ No browser fingerprinting
- ✓ EU-hosted infrastructure
- ✓ Data ownership stays with the customer
- ✓ GDPR, KVKK, CCPA compatible
Cookies Used
| Cookie | Purpose | Duration |
|---|---|---|
| _lynq_id | Anonymous visitor identifier | 2 years |
| _lynq_attr | Campaign attribution | 90 days |
For full details, see our Privacy Policy, Terms of Service, and GDPR Compliance pages.
FAQ
Do I need a cookie consent banner?
In most cases, no. Lynq uses only first-party cookies for anonymous analytics, which can be processed under legitimate interest (GDPR Art. 6(1)(f)). However, consult your legal advisor for your specific jurisdiction.
How is this different from Google Analytics?
Lynq runs entirely on your domain (first-party). This means no data goes to Google, ad blockers don't interfere, cookies persist longer, and you see all visitors — not a sample. Works for websites, SaaS products, and mobile apps.
Can I use Lynq alongside GA4?
Yes. Many customers run both during a transition period. Lynq doesn't interfere with other tracking scripts.
Where is my data stored?
Analytics data is stored in ClickHouse on EU infrastructure. Account data is stored in PostgreSQL. All connections use TLS encryption.
Can I export my data?
Yes. Every report can be exported as CSV. You can also use the API to pull data programmatically in JSON format.
What happens if I exceed my plan's page view limit?
We'll notify you and suggest upgrading. We won't silently stop collecting data. There's always a grace period.
Does Lynq work with single-page applications?
Yes. The tracker automatically detects client-side navigation (pushState / replaceState) and tracks page views accordingly.
Can I track multiple websites or apps?
Yes. Each website or app gets its own project ID. You can switch between projects in the dashboard header. We support web, iOS, Android, and Flutter.
What's the data retention period?
Default is 2 years for analytics events. You can request shorter retention periods if needed.
How do I delete all my data?
Contact us at privacy@lynq.studio. We'll delete all your data within 30 days.