Skip to main content
Tags mark a visitor so a later page or funnel step can branch on them: seen_vsl, declined_upsell, vip. Backend scripts get four functions for working with the same tags the Tag User and Has Tag nodes set and read.

hasTag(name)

Returns true if the visitor carries the tag, false otherwise. Finds tags set by the Tag User node, by ef.addTag() in the browser, and by addTag() below.

addTag(name, expirationMinutes?)

Adds a tag. Returns true if it was added, false if the name was rejected or the per-execution cap was hit.

removeTag(name)

Removes a tag. Returns true if the removal was queued, false if the name was rejected. Removing a tag the visitor does not have is not an error.

getTags()

Returns an array of the visitor’s tag names.
getTags() lists tags written by addTag() and by ef.addTag() in the browser. Tags written by the Tag User node are stored under a bare cookie name that is indistinguishable from any other cookie, so they cannot be enumerated — hasTag('name') still finds them.

Reserved and invalid names

addTag() and removeTag() return false without doing anything when the name is empty, longer than 120 characters, contains characters that are not valid in a cookie name (spaces, ;, =), or collides with a reserved cookie such as hop, subid, aff or the session cookie. This stops a tag from overwriting affiliate or session state.

A tag is visible immediately

A tag added by a backend script is visible to the rest of that same script, and to funnel nodes that run after it on the same request:
The Tag User node behaves differently: a tag it sets is only visible to a Has Tag node on the next request, not the one it was set on. If you need set-then-branch inside a single page load, set the tag with addTag() in a backend script rather than with a Tag User node.

How tags are stored

Tags are plain, unencrypted cookies. Two naming conventions exist for historical reasons: addTag() writes both names so a tag set from a backend script is visible everywhere — the Has Tag node, ef.hasTag() in the browser, and the tags array in Script Rules. hasTag() and removeTag() accept either spelling, so you do not have to think about which side set a tag.
Because tags are unencrypted cookies, a visitor can add or remove their own tags from the browser console. Use them for funnel flow and personalization — never as the only gate on paid content, pricing, or anything else where forging a tag would cost you.

Example: one-time offer

Show an offer once, then never again for 30 days.

Example: clearing a tag after purchase

See Queue for the cancellation tag used here — that is a job-grouping label, unrelated to visitor tags.

Limits

  • 50 tag writes per script execution. addTag() and removeTag() return false past that.
  • Each addTag() and removeTag() emits an add-tag / remove-tag tracking event, the same as the Tag User node and ef.addTag().