What is the default `data-cookie_duration` for the tracking pixel?

What happens when `data-cookie_duration` is omitted from the Affonso tracking script, and how long the referral cookie lasts by default.

Want to share instructions with partners?

If you do not set data-cookie_duration on the Affonso tracking script, the default is 30 days.

That same default is used if the attribute is present but not a valid integer.

Example

This script uses the default automatically:

<script
  async
  src="https://cdn.affonso.io/js/pixel.min.js"
  data-affonso="YOUR_PROGRAM_ID"
></script>

What the duration controls

data-cookie_duration controls how long the affonso_referral cookie and the affonso_data cookie stay on the visitor's browser.

If you want a different attribution window, add the attribute explicitly:

<script
  async
  src="https://cdn.affonso.io/js/pixel.min.js"
  data-affonso="YOUR_PROGRAM_ID"
  data-cookie_duration="60"
></script>

The value is interpreted in days.

If you are debugging the full tracking flow, see the tracking debug checklist.

Was this article helpful?