Open Source
Google Tag Linker
Decode, read, and manage Google Tag linker parameters without loading the full gtag.js library. Perfect for server-side environments, consent-aware setups, and custom tracking implementations.
Features
Cross-domain tracking, decoded
01
Linker Decoding
Parse and decode Google's _gl linker parameter to extract client IDs and session data.
02
No gtag.js Required
Works independently — no need to load the full Google tag library just for cross-domain support.
03
Server-Side Ready
Designed for server-side use cases where you need to read linker values from URLs or cookies.
04
TypeScript Support
Fully typed with TypeScript declarations for a great developer experience.
Quick Start
Simple API, powerful results
Installation
terminal
npm install @analytics-debugger/google-tag-linker
# or
bun add @analytics-debugger/google-tag-linkerRead linker from URL
client.js
import { GoogleTagLinker } from
"@analytics-debugger/google-tag-linker";
const linker = new GoogleTagLinker();
// Read linker values from the current URL
const linkerValues = linker.read(window.location.href);
console.log(linkerValues);
// {
// clientId: "123456789.1234567890",
// sessionId: "1234567890",
// timestamp: 1234567890,
// ...
// }Server-side usage
server.js
// Server-side: read linker from request
import { GoogleTagLinker } from
"@analytics-debugger/google-tag-linker";
export function handleRequest(req) {
const linker = new GoogleTagLinker();
const url = req.url;
// Extract cross-domain tracking data
const data = linker.read(url);
if (data.clientId) {
// Use the client ID from the
// originating domain
console.log("Client:", data.clientId);
}
}Let's Talk
Whether you need an implementation from scratch, an audit of your current setup, or expert advice — we're here to help.