Install Linqry on any website
If you can edit your site's HTML, you can install Linqry. Paste two lines before the closing </head> tag, deploy, and your first visit shows up in the Realtime view within seconds.
Updated · 2 min read
Install in three steps
- Add your site to Linqry
Start a free trial, then add your site's domain (for example
example.com). The Install page shows your site ID and a ready-to-copy snippet. - Paste the snippet before </head> on every page
Put it in the shared layout or template so it loads on every page. Replace
YOUR_SITE_IDandyourdomain.comwith the values from your Install page.<script>window.linqry=window.linqry||function(){(window.linqry.q=window.linqry.q||[]).push(arguments)}</script> <script defer data-website-id="YOUR_SITE_ID" data-domain="yourdomain.com" src="https://linqry.com/t.js"></script> - Deploy and check the Realtime view
Open your site in a new tab, then open Realtime in the Linqry dashboard. Your visit appears within a few seconds. Use the Realtime view rather than the browser's network tab to confirm the install: the collection endpoint answers
204whether or not an event was accepted.
What the two lines do
The first line defines a tiny queue, so any window.linqry(...) calls your code makes before the script has loaded are kept and sent once it arrives. The second line loads the tracker with defer, so it never blocks rendering. The tracker sets no cookies and stores nothing in the visitor's browser; see the privacy model for exactly what is collected.
Page views are recorded automatically, including route changes in single-page apps (the tracker listens to history.pushState, replaceState and popstate). Clicks on links to other domains are recorded as outbound events.
Optional attributes
| Attribute | What it does |
|---|---|
data-website-id | Required. Your site ID from the Install page. |
data-domain | The domain you registered. Pages on that domain, its subdomains (including www) and any extra hostnames you allow in site settings can report events. |
data-hash-routing | Count changes to the URL #hash as page views, for apps that route with the hash. Each route is reported as its own page, such as /#/pricing. |
data-exclude | Comma-separated paths to skip, with * as a wildcard, for example /admin/*,/preview. |
Exclude your own visits
Open your site, open the browser console and run the line below once. The tracker checks this flag and stays silent in that browser. Visits from localhost are ignored on linqry.com, so local development never pollutes your numbers.
localStorage.setItem('linqry_ignore', 'true')Track your first custom event
Add a data-linqry-event attribute to any element, or call window.linqry() from JavaScript. Events can carry properties and a revenue amount; see custom events and revenue tracking.
<button data-linqry-event="signup-clicked">Start free trial</button>
<script>window.linqry('newsletter-subscribed', { plan: 'weekly' })</script>Troubleshooting
- Nothing in Realtime? Check that the site ID matches the Install page and that the page's hostname is your registered domain, one of its subdomains, or an allowed host in site settings.
- Your site sends a Content-Security-Policy header? Allow
https://linqry.cominscript-src(to load/t.js) and inconnect-src(to send events). - Testing with an ad blocker on? Some blockers block analytics scripts, including Linqry's. Test in a clean browser profile.
- Bots are filtered by user agent in the browser and again on the server, so headless test runners usually won't show up.
Frequently asked questions
Do I need a developer to install Linqry?
No. If you can paste a snippet into your site's HTML or a 'custom code' setting, you can install it. Most site builders and CMSs have a place for code in the page head; the platform guides on this site show where.
Will the script slow my site down?
The tracker is ~1.5 KB gzipped and loads with defer, so it downloads in parallel and runs after the page has been parsed.
Does it work on single-page apps?
Yes. Route changes made with the History API are recorded as page views automatically. If your app routes with the URL hash, add data-hash-routing to the script tag.
Related
Two lines of HTML, no SDK, no build step. Works on any stack.
Send events from JavaScript or plain HTML attributes — plus the events Linqry records for you automatically.
What Linqry stores, what it never stores, how visitors are counted, and what that means for cookie banners.
Build a funnel from any custom events or URL paths and see how many visitors reach each step and where they drop off.
Start measuring your Any website site
No card required · 30-day trial · No cookies