Manual
Doppler SDK manual integration
Once you have created an account on Doppler and created an API Key, you can proceed with the next steps.
Installation
Pick your package manager and install the core SDK.
Setup
Make sure to define the following environment variable to store your API Key.
Usage
The core SDK exposes 2 methods:
getSource
logCrawl
The SDK is designed to sit in a middleware layer and be called on every request, then passing the URL & headers to the getSource
function and based on the result, you can call the logCrawl
function to log the traffic data to Doppler’s API.
Ideally you don’t await logCrawl in order not to slow down your request.
getSource
The getSource(headers: Record<string, string>, url: string)
function analyzes incoming requests to detect the traffic source. It accepts a request object with headers and URL, and returns a DopplerDetectionResult
object.
Parameters
Return type
logCrawl
The logCrawl(payload: DopplerCrawlPayload)
function sends traffic data to Doppler’s API. It accepts a payload object and an optional API key.
Parameters
Test
To test that your setup is correctly working you can try asking ChatGPT or Perplexity to search for your websites URL. Data should start showing up right after your request.