Skip to content
PricingDocs
All Integrations
AWS CloudFront

Device Intelligence for AWS CloudFront

Proxy integration via CloudFront Lambda@Edge origin-request function. Add visitor identification, bot detection, and smart signals to your AWS CloudFront application in minutes.

Quick Install

Add the SDK to your project with your preferred package manager.

npmnpm install aws-cdk
yarnyarn add aws-cdk
pnpmpnpm add aws-cdk

Basic Usage

Get up and running with the minimal setup.

$javascript
// Lambda@Edge function
exports.handler = async (event) => {
const request = event.Records[0].cf.request
if (request.uri.startsWith('/fp/')) {
request.origin = {
custom: {
domainName: 'your-fp-server.com',
protocol: 'https',
}
}
}
return request
}

Advanced Patterns

Production-ready patterns with error handling, loading states, and advanced configuration.

Lambda@Edge with Origin Rewrite & IP Forwarding — Click to expand
// Lambda@Edge — origin-request function
exports.handler = async (event) => {
const request = event.Records[0].cf.request
if (!request.uri.startsWith('/fp/')) {
return request
}
// Rewrite the origin to your tracio.ai server
request.uri = request.uri.replace(/^\/fp/, '')
request.origin = {
custom: {
domainName: process.env.FP_ORIGIN || 'fp.your-domain.com',
port: 443,
protocol: 'https',
sslProtocols: ['TLSv1.2'],
path: '',
readTimeout: 10,
keepaliveTimeout: 5,
},
}
// Forward client IP for accurate geolocation
request.headers['x-forwarded-for'] = [{
key: 'X-Forwarded-For',
value: request.clientIp,
}]
// Set cache behavior: cache agent script, skip identification
if (request.uri.includes('/agent')) {
request.headers['cache-control'] = [{
key: 'Cache-Control',
value: 'public, max-age=3600',
}]
}
return request
}

Configuration Options

All available options for initializing and configuring the SDK.

apiKeystringYour API key from the dashboard
endpointstringCustom endpoint URL for proxy-routed deployments
regionstringData region (us, eu, ap)
timeoutnumberRequest timeout in milliseconds
extendedResultbooleanAdds bot detection, incognito mode flags, and smart signals
linkedIdstringCustom identifier to associate visits (e.g. user ID or session ID)

Next Steps

Go deeper with the full API reference, webhook configuration, and advanced guides.

Get started with AWS CloudFront

Add device fingerprinting to your AWS CloudFront application in under 5 minutes.