WordPress

Add the Lienks snippet to the head of your WordPress site in a way that survives theme updates.

Before you start

Create your site and copy its site ID first (see Quick start).

Add the snippet

The snippet has to end up in the <head> of every page. There are two ways.

Option 1: with code – add this to the functions.php of a child theme (or to a small plugin of your own):

add_action('wp_head', function () {
    echo '<script defer src="https://app.lienks.com/a.js" data-site="YOUR_SITE_ID"></script>';
});

Use the child theme, not the main theme, because theme updates overwrite the main theme’s files. A plain wp_head hook is the simplest way here: wp_enqueue_script doesn’t output the data-site attribute on its own.

Option 2: without code – use a plugin that lets you insert scripts into the header (a header scripts plugin). Paste the snippet there:

<script defer src="https://app.lienks.com/a.js" data-site="YOUR_SITE_ID"></script>

Track a custom event

Call window.lienks?.event('signup_clicked') wherever something should be counted. More in Custom events.

<button onclick="window.lienks?.event('signup_clicked')">Sign up</button>

Add it to a custom HTML block or to your theme code.

Check that it works

Open your site. The first pageview shows up in the dashboard. If nothing arrives, see Troubleshooting.

Good to know

  • Caching and optimization plugins and CDNs often serve old pages. Clear the cache afterwards so the snippet appears in the delivered HTML.
  • Some optimization plugins move or block scripts. If nothing reaches Lienks, check the settings of such a plugin (Troubleshooting).