Skip to main content

Add session ID to forms

note

This part of the tag setup is entirely optional.

The Hitprobe tag has a convenience feature that will write in the current visitor's session ID into any form field with an data-hp-session-id attribute.

For example, add this hidden input field to your form:

<input data-hp-session-id name="session_id" type="hidden" value="">

After the Hitprobe tag has registered the visit, the session ID will be written into the value attribute. You can actually name the field anything you want as long as the data-hp-session-id attribute is present.

This is useful where you want to record the session ID against a lead or signup. You can then either manually lookup the visitor session details in the console, or use the Hitprobe API to read the session or set a conversion.

tip

If you only need to set a conversion, you may find it easier to trigger a tag conversion event instead.