Get lifetime 30% off with code BLACKFRIDAYSale ends in 3 days 14 hours 39 minutes 52 seconds

How to track page views without Google Analytics

Use Logspot to track page views in your website, React or Next.js application.

Bartek@spolsky_co· Jan 5th 2022

Google Analytics is the most popular web analytics tool. It's very easy to add to your page. GA provides you advanced analytics dashboard where you can analyze incoming traffic. You get real-time analytics for free.

However, sometimes, you just want to have a simple dashboard where you can look up your app's statistics, especially when you want to track your in-app customers.

Logspot allows you to track any activity user does in your application. You can track browser visits, button clicks, sign-ups, or anything you can think of.

This article will show you have you can track page views with Logspot.

Track page views on your website

If you have a website that is not using the NPM, you can use our JS script. Embed the script in the <head> section.

<script async data-logspot-pk="YOUR_PUBLIC_KEY" src="<https://cdn.logspot.io/lg.js>"></script>

Track page views in React application

In the case of React application, you need to put the tracking code

import Logspot from '@logspot/web';

Logspot.init({ publicKey: "YOUR_PUBLIC_KEY" });

...

export default App;

Now your React application is automatically tracking page views.

Track page views in the Next.js application

In your _app.js, you can define the following code:

import Logspot from '@logspot/web';

function MyApp({ Component, pageProps }) {
  // Logspot needs to be inside useEffect, because it uses window object
  useEffect(() => {
    Logspot.init({ publicKey: "YOUR_PUBLIC_KEY" });
  }, []);

  return <Component {...pageProps} />;
}

export default MyApp;

Ready to start tracking?

Start in under 2 minutes.

  • Product tracking
  • Embeddable insights
  • Automations

No credit card required.

Cancel anytime.

The easiest way to track your SaaS product's activity with awesome dashboards.

Subscribe to product updates


© Copyright 2022, All Rights Reserved by Logspot