Install on WordPress

Add PerchLens to any WordPress site via theme functions or a header plugin.

Under 2 minutes4 stepsVisit WordPress
  1. Easiest: install a header injection plugin

    Search the plugin directory for 'Insert Headers and Footers' (by WPBeginner) or 'WPCode'. Both let you add scripts without touching theme files.

  2. Paste the script

    In the plugin's settings, find the 'Scripts in Header' field and paste the tracking script.

    <script defer src="https://perchlens.com/cv.js" data-site="{SITE_ID}"></script>
  3. Alternative: edit your theme's functions.php

    If you prefer not to install a plugin, hook into wp_head from your child theme.

    <?php
    add_action('wp_head', function() {
        echo '<script defer src="https://perchlens.com/cv.js" data-site="{SITE_ID}"></script>';
    });
  4. Verify

    Visit your site once, then check the PerchLens dashboard. Realtime visitors should update within a few seconds.

Tip: Replace {SITE_ID} in the snippets above with your actual tracking ID. You'll find it in Settings → Tracking after creating a site.

Troubleshooting

Editing functions.php broke my site

Use a child theme — never edit the parent theme's functions.php directly. If you're locked out, edit via FTP/SSH and revert.

Caching plugin (W3 Total Cache, WP Rocket) shows stale visitor counts

Exclude the PerchLens script from minification in your caching plugin's settings. Pageviews still track correctly — it's only the page that's cached.

Other platforms

No PerchLens account yet?

Create a free account to get your tracking ID — takes about 30 seconds.

Set it up in 30 seconds. Replaced two paid tools.

Indie maker on X

Finally, analytics I actually look at every day.

SaaS founder

My users appreciate no cookie banner. I appreciate the simplicity.

Agency developer

Ready for simpler analytics?

Join thousands of makers who track their sites with clarity, not complexity. Free forever for up to 3 sites.