Skip to content
Install guide · CMS & blogs

Install Linqry on WordPress

To add Linqry to WordPress, put the two-line snippet into every page's `<head>`, either with a header-code plugin or with a `wp_head` hook in a child theme's `functions.php`. Both take a few minutes and survive theme updates; editing the theme's `header.php` directly does not.

Updated · 3 min read

Option 1: a header-code plugin (no code)

  1. Copy your snippet

    Start a free trial, add your site's domain and copy the snippet from the Install page.

  2. Install a header and footer code plugin

    In your dashboard, open Plugins and add a plugin that inserts code into the site header. A widely used one is WPCode (Insert Headers and Footers + Custom Code Snippets); its Code Snippets menu has a header and footer screen with a field for scripts in the header.

  3. Paste the snippet into the header field and save

    Paste both lines into the header box, not the footer or body box, and save.

    <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>
  4. Check Realtime

    Open your site in a private window (so you're logged out and no cache plugin is serving you a special version), then open Realtime in Linqry. Your visit appears in the live event stream within a few seconds.

Option 2: a wp_head hook in a child theme

If you'd rather not add a plugin, print the snippet from the wp_head action, which themes fire inside <head> on the front end. Put it in a child theme's functions.php (or a small site-specific plugin). The WordPress handbook explains why: changes to a parent theme's files are lost when the theme updates, while a child theme's functions.php is loaded alongside the parent's and survives.

<?php
// wp-content/themes/your-child-theme/functions.php
add_action('wp_head', function () {
    // Don't count yourself or other logged-in editors.
    if (is_user_logged_in()) {
        return;
    }
    ?>
    <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>
    <?php
});

The is_user_logged_in() check is optional, but on most blogs and business sites it's the easiest way to keep authors and admins out of the numbers. On a membership or WooCommerce site where customers log in, use current_user_can('edit_posts') instead, so only staff are skipped.

WordPress.com sites

On WordPress.com, installing plugins is available on the paid plans (Personal, Premium, Business and Commerce at the time of writing). Once plugins are available, Option 1 works the same way. WordPress installed on your own hosting has no such restriction.

Caching and optimization plugins

  • Clear your page cache after adding the snippet, or cached pages keep serving HTML without it.
  • Exclude the snippet from JavaScript optimizations. Features that combine, defer further or delay JavaScript until user interaction can stop the tracker from running for visitors who never scroll or click. Add linqry.com/t.js and the inline window.linqry stub to the plugin's exclusion list.
  • Logged-in previews aren't representative. Many caching setups bypass the cache for logged-in users, so check the live page while logged out.

Track signups and button clicks

Any element with a data-linqry-event attribute sends an event when clicked. In the block editor, use a Custom HTML block, or open a block's Edit as HTML view, and add the attribute to a link or button. Events can be used as goals and funnel steps; see custom events for naming rules.

<a class="wp-element-button" href="/contact/" data-linqry-event="contact-clicked" data-linqry-event-location="footer">Contact us</a>

For form plugins that show a thank-you page after submitting, you don't need an event at all: make the thank-you page a page-visit goal. Links to other sites, such as affiliate links, are recorded as outbound events automatically.

Troubleshooting

  • Nothing in Realtime? View the page source while logged out and search for t.js. If it's missing, clear caches; if it's there, check the site ID against the Install page.
  • Multisite or a separate shop domain? Subdomains of your registered domain are accepted automatically. Add other domains under Additional hosts in site Settings.
  • Exclude yourself in one browser without code by running localStorage.setItem('linqry_ignore', 'true') in the console on your site.

Frequently asked questions

Is there a Linqry WordPress plugin?

No. Linqry doesn't publish a WordPress plugin. A general header-code plugin or the wp_head snippet above does the same job and keeps you in control of the code.

Will this conflict with my cookie consent plugin?

The tracker sets no cookies and stores nothing in the browser. Some consent plugins hold back scripts by category until a visitor agrees, so check how yours classifies the snippet. Whether your site needs a consent banner is for you and your legal advisor to decide; the [privacy model](/docs/privacy) lists exactly what Linqry collects.

Does it slow WordPress down?

The tracker is ~1.5 KB gzipped and loads with defer, so it doesn't block rendering. It's usually far smaller than a theme's own scripts.

Sources

  1. WordPress Developer Resources: wp_head hook (checked Nov 9, 2026)
  2. WordPress Theme Handbook: Child themes (checked Nov 9, 2026)
  3. WordPress.org: WPCode – Insert Headers and Footers plugin (checked Nov 9, 2026)
  4. WordPress.com Support: Plugins (checked Nov 9, 2026)

Start measuring your WordPress site

No card required · 30-day trial · No cookies