Manage write keys

A write key identifies the event stream that receives events from your website. Each event stream that uses the SDK can have more than one write key.

Write keys are public. A write key is visible in your website’s page source. It can only send events to its event stream. It cannot read data or change settings.

Important

Treat write keys as identifiers, not secrets. Do not reuse an API key or an access token as a write key, and do not place API keys or access tokens in your website.

Generate a write key

To generate a write key

  1. From the Events page, open Event streams, and then open the event stream.

  2. Under SDK configuration, find Write keys.

  3. Select Generate write key.

  4. Select the copy icon next to the write key to copy it.

If the stream has not accepted the current Amperity SDK Terms, Amperity asks you to accept them before it generates the key.

Amperity lists each write key with the time it was created. Write keys remain listed on the event stream settings page. They are not shown only once.

Note

You must have the profile-events:write permission to generate a write key. You must have the profile-events:read permission to view write keys.

Rotate a write key

Rotate a write key by using more than one key at the same time, so that your website does not stop collecting events:

  1. Generate a new write key.

  2. Deploy the new write key to your website.

  3. Delete the old write key after your website no longer uses it.

Delete a write key

To delete a write key

  1. From the Events page, open Event streams, and then open the event stream.

  2. Under SDK configuration, find Write keys.

  3. Select the delete icon next to the write key.

  4. Confirm the deletion.

After you delete a write key, the collector stops accepting events that use that key. Events that are sent with the key stop being collected within a minute. You cannot undo this action.

Note

You must have the profile-events:delete permission to delete a write key.

Note

A new write key can take up to a minute to become active. Events that are sent with a new key during that time may receive a 404 Not Found response. See Troubleshoot the SDK.