Skip to content
All documentation pages

Install guides

Install on WordPress

There is no plugin to install from us. The tag goes into your theme’s head, like any other script.

With a header code plugin

  1. Install a plugin that adds code to the site header, such as WPCode.
  2. Paste the tag into its header section and save.
  3. Clear any page cache so visitors get the updated pages.
Header codeHTML
<script defer
  src="https://cdn-stg.webmetric.io/v1/b.js"
  data-key="wm_w_your_write_key"
  data-host="https://in-stg.webmetric.io"></script>

With your theme’s functions.php

If you maintain a child theme, add this to its functions.php. Changes to a parent theme are lost when it updates.

functions.phpPHP
add_action('wp_head', function () {
    echo '<script defer src="https://cdn-stg.webmetric.io/v1/b.js" data-key="wm_w_your_write_key" data-host="https://in-stg.webmetric.io"></script>';
});

Caching and optimisation plugins

Plugins that combine, minify or delay JavaScript can rewrite the tag and drop its data- attributes, which stops tracking. Exclude b.js from combining and delayed loading, then clear the plugin’s cache.

Verify

View the source of a page while signed out and check that the tag is there with its data- attributes. Then open Overview. If nothing arrives, see troubleshooting.