Getting Started

How to install PrettyInsights snippet code to track website visits

Want to track visits, page views, and user activity across your website? Installing the PrettyInsights tracking snippet is the first step. This guide will walk you through the process in just a few minutes. PrettyInsights is a free google analytics alternative that will help you track website visits, organic traffic, tracking conversions and so much more.

What Is the PrettyInsights Tracking Snippet?

The PrettyInsights tracking snippet is a lightweight JavaScript code that you add to your website. It collects anonymized visitor data like page views, referrers, and session behavior — all without slowing down your site or compromising user privacy.

Step-by-Step: Installing the Tracking Snippet

Step 1: Log in to Your PrettyInsights Dashboard

  1. Go to https://prettyinsights.com.

  2. Log in using your email and password.

  3. From your dashboard, click “Websites” in the sidebar.

  4. Choose your website or click “Add New Website” to create a new one.

Step 2: Copy the Tracking Snippet

Once you’ve added your website:

  1. Go to the Install Snippet tab.

  2. You’ll see a small block of JavaScript code that looks like this:

<!-- PrettyInsights Tracking Snippet -->
<script async src="https://cdn.prettyinsights.com/pi.js"></script>
<script>
window.pi=window.pi||function(){(pi.q=pi.q||[]).push(arguments)};
pi('init', 'YOUR-WEBSITE-ID');
</script>
  1. Click “Copy Code” to copy the snippet to your clipboard.

✅ Replace YOUR-WEBSITE-ID with your actual ID shown in the dashboard.

Step 3: Paste the Snippet Into Your Website

You need to paste the snippet just before the closing </head> tag of your website’s HTML.

If you use plain HTML:

Open your HTML file and paste the code like this:

<head>
...
<!-- PrettyInsights Tracking Snippet -->
<script async src="https://cdn.prettyinsights.com/pi.js"></script>
<script>
window.pi=window.pi||function(){(pi.q=pi.q||[]).push(arguments)};
pi('init', 'YOUR-WEBSITE-ID');
</script>
</head>

If you use WordPress:

  1. Go to your WordPress admin dashboard.

  2. Install and activate a plugin like “Insert Headers and Footers”.

  3. Navigate to Settings → Insert Headers and Footers.

  4. Paste the snippet inside the Header section.

  5. Click Save.

If you use a website builder (Wix, Squarespace, Webflow, etc.):

Look for a Custom Code or Site Header section in your builder’s settings and paste the snippet there.

Confirm It’s Working

After installation, go back to your PrettyInsights dashboard:

  1. Open your website’s tracking page.

  2. Visit your site in a new browser tab or device.

  3. Refresh the dashboard – you should see live visitor activity or data updates.

If it doesn’t show up within 1–2 minutes, double-check that:

  • The code is placed before the </head> tag.

  • Your Website ID is correct.

  • Caching plugins or CDNs (like Cloudflare) are not blocking JavaScript.

Need Help?

If you’re having trouble, reach out to our support team directly from your dashboard, or email us at admin@prettyinsights.com. We’ll get you set up in no time.

Pro Tip: Enable Event Tracking (Optional)

Once the snippet is installed, you can also start tracking custom events like button clicks, form submissions, or product views using the pi('event', 'event_name') function.

Example:

pi('event', 'signup_form_submitted');

That’s It!

You’re all set. PrettyInsights is now tracking your website visits, page views, and interactions in real time. Check back in your dashboard to explore your traffic sources, top-performing pages, user paths, and more.