Auto-configuration reference ΒΆ

When you enable spec.frontend.generatedConfig in your nais.yaml, the platform generates configuration values your frontend can use at runtime. This removes the need to hardcode collector URLs or app metadata.

yaml

Generated JavaScript file ΒΆ

The platform creates a JavaScript file at the specified mountPath with this structure:

js

The example URL is for prod-gcp.

FieldSource
telemetryCollectorURLSet per cluster by the platform operator
app.namemetadata.name from your nais.yaml
app.namespacemetadata.namespace from your nais.yaml
app.versionTag from your container image

The collector URL is set automatically based on which cluster your app runs in. You don't need separate configuration for each environment.

Environment variable ΒΆ

The platform also sets this environment variable in your pod:

VariableDescription
NAIS_FRONTEND_TELEMETRY_COLLECTOR_URLThe telemetry collector URL for your cluster

This is useful for server-rendered applications (Next.js, Remix) where the server can read the env var and pass it to client-side code. See the Next.js guide for an example.

Collector URLs by environment ΒΆ

EnvironmentCollector endpoint
dev-gcphttps://telemetry.ekstern.dev.nav.no/collect
prod-gcphttps://telemetry.nav.no/collect

On-premises clusters are not supported.

When to use auto-configuration ΒΆ

Static frontends (nginx, CDN): Use the generated nais.js file. Import it at runtime and use nais.telemetryCollectorURL and nais.app. See the setup guide.

Server-rendered apps (Next.js, Remix): Read NAIS_FRONTEND_TELEMETRY_COLLECTOR_URL on the server and pass it to your client-side Faro initialization. See the Next.js guide.

Manual alternative: The collector URL for prod-gcp is https://telemetry.nav.no/collect. Other environments use the URLs listed above.