Ready-to-use JavaScript and Python code for all three ENS Ads operations: fetching campaigns, recording impressions, and recording clicks from your server.
Use this file to discover all available pages before exploring further.
The examples below cover all three API operations you need to integrate ENS Ads: fetching campaigns, recording impressions, and recording clicks. Each section shows both JavaScript and Python implementations side by side so you can drop the relevant code directly into your server-side integration.
Store your API key in an environment variable (for example, process.env.ENS_API_KEY in Node.js or os.environ["ENS_API_KEY"] in Python) rather than hardcoding it in your source code. This keeps the key out of version control and makes it easier to rotate without a code change.
Call this when the user clicks or otherwise interacts with the campaign. Pass the same campaignId, placement, location, and device values you used for the impression call.