identify() and setTraits()
Attaching your own id to events, recording traits and their history, and the privacy trade you make when you do.
Micaforge is cookieless by default. A visitor is a daily-rotating salted hash and nothing else, which means a returning reader tomorrow is a new visitor. That is the deal, and for most sites it is the right one.
identify() is the opt-in exception, for a product where you already know who is signed
in.
micaforge.identify("u_123");
micaforge.identify("u_123", { plan: "pro" });
The id is written to identified_id on every event sent afterwards. A second argument is
merged into the default properties, exactly as setProps would, and recorded as the
person’s traits.
Clear it on sign-out:
micaforge.identify(null);
setTraits()
Record traits without changing the id or the default properties:
micaforge.setTraits({ plan: "team", seats: 12 });
Use it when something about the person changes mid-session: an upgrade, a role change. The traits are recorded on the profile and nowhere else; they are not added to every event.
What identify() sends
Each identify() or setTraits() call that changes something sends one small identify
event carrying the id and the traits passed with that call. A repeat of the same call (a
router effect that runs on every navigation) sends nothing. identify(null) sends nothing.
That event is what the server builds the profile from:
- Trait history. Every call that changed a trait is kept with the time it arrived, so a profile shows when the plan changed, not only what it is now. The current traits are the calls folded in order, the later value winning.
- Linked visitors. The call carries that day’s visitor hash, and the server links the
two. The profile then shows the sessions recorded under that hash earlier the same day,
before the call: what the person did before they signed in. Only what your own
identify()call ties together is linked. Micaforge never links two hashes by guessing, and a hash from a day with noidentify()call stays anonymous. - Search. On the Visitors screen, the search box finds a person by their id or by any trait, an email address for example.
What changes when you use it
- Events from the same account join up across days and devices, which the visitor hash cannot do.
- The visitor screens can show a profile: sessions, first seen, last seen, traits, their history, and the anonymous sessions linked to the id.
identified_idbecomes a filter dimension like any other.
What it costs
An identified row is personal data. The rest of the product is built so that there is none, and this is the one call that changes that, so it is worth being deliberate:
- Send an opaque id.
u_123, not an email address, not a name. If your id is reversible only through your own database, the event store still holds nothing readable on its own. - Say so. An identified analytics stream belongs in your privacy notice. See GDPR for what the rest of the system does and does not store.
- Traits are personal data too. An email address in a trait is stored on the profile and is what makes the email search work. If you do not need to find people by email, do not send it.
- Retention still applies. Identified rows expire with everything else under your retention setting.
- Erasure reaches everything linked. Erasing a person by their id on the visitor screen
deletes their identified events, their trait history, and the anonymous activity of every
daily hash an
identify()call linked to them.
From the server
The server SDK carries the same field, which is often the better place for it, because your server already knows the account and the browser only thinks it does.
micaforge.track({
name: "invoice_paid",
url: "https://example.com/billing",
identifiedId: "u_123",
revenue: 49.0,
currency: "GBP",
});
What it is not
It is not a login, not a cross-site identifier and not a way to un-hash a visitor. Events
sent before the call keep the visitor hash they had; identifying does not go back and
relabel history. The profile links those earlier sessions to the id by reading the
identify event, and only for the day hash that event carried.