← All IntegrationsIntegration
Analytics for AWS
Teams on AWS run web apps, CLI tools, and APIs across dozens of services. BetterMeter gives you a single analytics layer across all of them — CloudFront for first-party web tracking, the Node SDK for Lambda functions and ECS services, and the CLI for pipeline reporting.
CloudFront behavior for first-party proxy
Add a CloudFront cache behavior that routes /bm/*requests to BetterMeter as an additional origin. The tracker script loads from your domain, bypassing ad blockers while leveraging CloudFront's global edge network.
CloudFront Additional Origin + Behavior
Origin:
Domain: bettermeter.com
Protocol: HTTPS only
Origin Path: /api
Cache Behavior:
Path Pattern: /bm/*
Origin: bettermeter.com
Viewer Protocol: HTTPS only
Allowed Methods: GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE
Cache Policy: CachingDisabled
Origin Request Policy: AllViewerExceptHostHeaderTrack Lambda functions and API Gateway
Use the @bettermeter/node SDK inside Lambda functions to track API endpoint usage. The SDK batches events efficiently to minimize Lambda execution time.
Lambda handler with BetterMeter
import { BetterMeter } from "@bettermeter/node";
const bm = new BetterMeter({
siteId: "my-api",
apiKey: process.env.BETTERMETER_API_KEY,
});
export const handler = async (event) => {
await bm.trackApi({
method: event.httpMethod,
path: event.path,
statusCode: 200,
});
return { statusCode: 200, body: JSON.stringify({ ok: true }) };
};Unified view across AWS services
- 01S3 + CloudFront static sites — Add the tracker script tag. CloudFront proxy keeps it first-party.
- 02ECS / Fargate APIs — Use the Node SDK's Express middleware for automatic route tracking.
- 03Lambda@Edge — Inject the tracker script at the edge for server-rendered pages.
- 04CodePipeline / CodeBuild — Run the BetterMeter CLI in build steps for automated reporting.
CloudFront Proxy
First-party at the edge
Lambda SDK
API tracking
Unified Dashboard
Web + API + CLI