GuidesAudience

Analytics for AI-generated apps, set up in one file

One script tag, ten event names, and you finally know if anyone uses it.

You built something with Cursor, Claude Code, v0, Lovable or Bolt, shipped it, and now you want to know whether anyone actually uses it. Privytics answers that with one script tag in your index.html or root layout, plus a handful of named events you define once and reuse. The free tier is 10,000 events a month with no credit card, so an agent can wire the whole thing up in a single pass without stopping to ask you for billing details.

Why Vibe-coded apps teams use Privytics

One file is the whole install

Generated apps usually have exactly one index.html or one root layout. That is the only file you touch. There is no package to install, no bundler config to edit, no provider component to thread through a tree you did not write and do not want to read.

An agent can finish the job without a card

The free tier is 10,000 events a month, one project, 12 months retention, no credit card. That matters when you are handing the task to Cursor or Claude Code: the setup completes end to end instead of stalling on a checkout page you have to fill in by hand.

A named taxonomy survives the next regeneration

The usual failure is not missing tracking, it is drift. Ask a generator for tracking three times and you get signup, user_signed_up and SignupSuccess, which land as three unrelated events and three broken charts. Put every event in one small module and the regenerated component imports the same names it did last week.

Cookieless by default, so there is nothing to retrofit

Generated apps rarely ship with a consent layer, and bolting one on later is miserable. The tracker sets no cookies and writes nothing to the device. Visitors are counted with an anonymous id that resets every day. You are still the data controller and still decide what your notice says, but the default costs you no plumbing.

Set it up

About five minutes, on the free plan, without a credit card.

  1. Paste the script tag into your one HTML file

    Put both tags in the <head> of index.html, or in the root layout if your generator produced a framework app. Replace YOUR_CLIENT_ID with the client id from your Privytics project. Setting apiUrl is required: leave it out and the SDK sends your events to OpenPanel's hosted API instead of yours. With trackScreenViews on, page views start arriving on the next load and client-side route changes are picked up too. The global is called window.op and the file is op1.js because Privytics runs on the open-source OpenPanel engine and uses its official SDKs unchanged. Privytics is independent and is not affiliated with, endorsed by or sponsored by OpenPanel.

    <script>
      window.op=window.op||function(){var n=[];return new Proxy(function(){arguments.length&&n.push([].slice.call(arguments))},{get:function(t,r){return"q"===r?n:function(){n.push([r].concat([].slice.call(arguments)))}} ,has:function(t,r){return"q"===r}}) }();
      window.op('init', {
        apiUrl: 'https://api.privytics.com',
        clientId: 'YOUR_CLIENT_ID',
        trackScreenViews: true,
        trackOutgoingLinks: true,
      });
    </script>
    <script src="https://privytics.com/op1.js" defer async></script>
  2. Put every event in one file

    This is the step that decides whether the data is still useful in three months. Define the events once, in one module, and let the rest of the app import from it. Nothing else calls window.op directly. Keep it to five or ten events, name them object_verb in snake_case and past tense, and keep properties as short enums rather than free text. When you next ask an agent to add tracking, point it at this file and tell it to reuse an existing name or add exactly one.

    // src/analytics.js
    // Every event this app can send lives here.
    // Naming rule: snake_case, past tense, object first. Properties are short enums.
    
    const track = (name, properties) => {
      if (typeof window !== 'undefined' && window.op) {
        window.op('track', name, properties);
      }
    };
    
    export const analytics = {
      signupCompleted: (method) => track('signup_completed', { method }), // 'email' | 'google'
      projectCreated: (source) => track('project_created', { source }), // 'onboarding' | 'dashboard'
      generationRequested: (model) => track('generation_requested', { model }),
      generationFailed: (reason) => track('generation_failed', { reason }), // 'timeout' | 'quota' | 'invalid_input'
      exportDownloaded: (format) => track('export_downloaded', { format }), // 'csv' | 'pdf'
      planUpgraded: (plan) => track('plan_upgraded', { plan }),
    };
    
    // src/components/SignupForm.jsx
    import { analytics } from '../analytics';
    
    const onSuccess = () => {
      analytics.signupCompleted('google');
    };
  3. Keep personal data out of properties

    The second common accident: a generator wires up tracking by passing whatever object is in scope, and the user's email, name or raw prompt text ends up as an event property. Analytics properties are the wrong place for that. Describe the event, not the person. If you genuinely need cross-session profiles, use identify() with your own opaque user id and your own lawful basis, rather than smuggling identifiers into every event.

    // Wrong. Personal data in analytics properties, usually by accident.
    window.op('track', 'signup_completed', {
      email: user.email,        // no
      name: user.fullName,      // no
      prompt: input.value,      // no, free text is full of personal data
    });
    
    // Right. Describe the event, not the person.
    window.op('track', 'signup_completed', {
      method: 'google',
      plan: 'free',
      prompt_length: input.value.length,
    });
    
    // App-wide context belongs in global properties, set once after init.
    window.op('setGlobalProperties', {
      app_version: '2026.07.19',
      environment: 'production',
    });

Privytics runs the open-source OpenPanel engine, so the upstream Vibe-coded apps SDK reference applies here too. Point apiUrl at Privytics and the data lands in your Privytics project.

Questions

How do I add analytics to an app built with Lovable, Bolt or v0?

Paste the two script tags from step one into the <head> of index.html, or into the root layout if the generator gave you a framework app. Set clientId to your Privytics client id and apiUrl to https://api.privytics.com. Page views are recorded from the next load. Everything past that is your own track() calls.

Can Cursor or Claude Code set this up for me?

Yes, and it is a reasonable thing to delegate. Give the agent the snippet from step one and the taxonomy file from step two, and tell it to reuse the existing event names rather than invent new ones. The free tier needs no credit card, so the agent will not hit a checkout wall halfway through. Review the diff for personal data in event properties before you deploy.

I accidentally sent email addresses as event properties. What do I do?

First stop sending them: fix the track() call and ship it, because every hour it stays live adds more rows. Then decide what to do with what is already stored. On a small project the simplest clean fix is to delete the project, which removes its events, and start a fresh one with the corrected taxonomy. If deleting is not practical, contact us and describe what was sent and to which project.

When is Privytics the wrong choice?

Three honest cases. If all you want is a visitor count on a static page and you will never send a custom event, a plain page view counter is less to think about. If session replay is the whole reason you are here, note that replay is a paid feature, so the free tier will not give you it. And if you want to join event data against your own production database in SQL, you want a warehouse and a BI tool, not a product analytics UI. Privytics fits when you want funnels, retention and named events over a small app you actually shipped.