Specify docs

Advertiser keys

Create development and production keys, and where to put them in your app.

An advertiser key connects the events you send to your Specify organization. It's a string that starts with sak_.

Create a key

  1. Open the Advertiser Keys page on the Specify dashboard.
  2. Select Create new +, then Development.
  3. Copy the key and store it with your other configuration.

Development and production keys

Development keys are for building and testing your integration. They work straight away, including while your organization is waiting for approval. Specify accepts their events but never records them, so test as much as you like.

Production keys record events and are what your live site uses. You can create one once your organization is approved.

Where to put it

Advertiser keys ship to the browser, so they are public by design. The same key works in your server code.

Read it from your environment anyway, so development and production builds pick up the right one.

.env.local
SPECIFY_ADVERTISER_KEY=sak_0123456789abcdef0123456789abcd
lib/specify.ts
import Specify from '@specify-sh/advertiser-sdk';

export const specify = new Specify({
  advertiserKey: process.env.SPECIFY_ADVERTISER_KEY!
});

Frameworks that only expose prefixed variables to the browser need the prefix, such as NEXT_PUBLIC_SPECIFY_ADVERTISER_KEY in Next.js. That's fine: the key is public.

Revoking a key

Select Revoke on the Advertiser Keys page. Events sent with it are rejected from then on, so deploy its replacement first.

Invalid keys

With a malformed key, the browser client does nothing, and your server's capture() throws ValidationError. A well-formed key that is revoked or unknown is rejected when its events arrive.

On this page