Skip to content
Frameworks

Angular analytics with Reveata

2 min read · Updated · By the Reveata team

Short answerPaste the Reveata snippet before the closing head tag of src/index.html. ng build keeps it in the built page, server-side rendering included, and the Angular Router's History API navigation is counted automatically. HashLocationStrategy needs data-hash="true".

Angular apps are often business software with sign-ups, trials and paid plans. Reveata adds traffic and revenue analytics without a service to inject or a router subscription to write.

What you get

  • Every route counted. The Angular Router changes pages through the History API, which the script follows.
  • Goals from templates, including bound values, or from components.
  • Revenue attribution by sending the visitor id with your checkout request.
  • Local runs left out: ng serve on localhost is ignored unless you add data-allow-localhost="true".

How to install it

Paste the snippet before </head> in src/index.html. ng build keeps the tag in the built index.html, with server-side rendering too. If you use HashLocationStrategy (URLs like /#/settings), add data-hash="true" to the tag. Angular's routing options are documented at angular.dev (opens in a new tab).

Goals in templates and components

Templates accept the attribute as it is:

html
<button data-reveata-goal="signup">Sign up</button>

For a value that changes, bind it: [attr.data-reveata-goal-plan]="plan". From a component, call the script:

ts
(window as any).reveata?.('goal', 'signup');

See custom goals for properties and naming rules.

Linking payments to visits

Connect your payment provider in Reveata, then send window.reveata.metadata() with the HTTP request that creates the checkout. It returns { reveata_visitor_id, reveata_session_id }, or {} in cookieless mode. Your backend copies those keys into the checkout's metadata, and the payment is credited to the visit under your attribution model. Provider by provider:

Provider Where the ids go
Stripe Checkout Session or PaymentIntent metadata
Polar Checkout metadata
Dodo Payments Checkout metadata

More in connect a payment provider and Stripe revenue analytics.

Frequently asked questions

Do I need an Angular library?

No. One tag in src/index.html covers the app. Calling window.reveata from components is optional.

Does server-side rendering change anything?

No. The tag stays in the rendered HTML, and the script starts in the browser.

What if no ids are available?

In cookieless mode or with a blocked script there are none. Identify signed-in users instead, and payments match by email (identify visitors).

See it with your own numbersReveata ties every visit and sale to the source that brought it. Add your website in a minute.
Get started
Was this page useful?
IntegrationAstro analytics with revenue attributionPaste the Reveata snippet with is:inline into the Astro layout that renders the head of every page. Astro then leaves the tag as written, view transitions are tracked, and payment links or checkouts started from your pages are credited to the visit behind them.IntegrationDjango analytics with revenue attributionPaste the Reveata snippet before the closing head tag of the base template your Django templates extend. Every page is tracked, the Django admin is not, and two hidden form fields let your checkout view put the visitor id into the payment's metadata.IntegrationDocusaurus analytics for documentation sitesAdd the Reveata script to the scripts array in docusaurus.config.js, or build the entry with @reveata/next/snippet. Page changes inside the docs are tracked by the script, so every page a reader opens is counted.IntegrationExpress.js analytics with a first-party proxyPaste the Reveata snippet into the layout, static HTML or front-end index.html your Express app serves. Two Express routes can serve the script from your own domain with your proxy secret, and your checkout route can copy the visitor id into the checkout metadata.IntegrationFastAPI analytics with ReveataPaste the Reveata snippet into the base Jinja2 template of your FastAPI app, or into the index.html of the front end FastAPI serves. Two FastAPI routes can serve the script from your own domain, and your checkout endpoint can put the visitor id into the payment's metadata.IntegrationFlask analytics with ReveataPaste the Reveata snippet into the base Jinja template your Flask pages extend. Every page is tracked, two small Flask routes can serve the script from your own domain, and your checkout route can copy the visitor id into the payment's metadata.