🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Clarity and Hotjar Premium Add-on Setup Guide

Updated 8 min read Gravity Forms Analytics & Ad Tracking
On this page
  1. Video walkthrough
  2. What you need
  3. Install and activate
  4. Where to send
  5. What to send
  6. Consent
  7. Settings for one form
  8. Sending a field value on purpose
  9. Confirmations that redirect
  10. A worked example
  11. Testing your setup
  12. Privacy and good practice
  13. For developers
  14. Frequently asked questions
  15. Does the add-on install Clarity or Hotjar?
  16. Does it work with cached pages?
  17. Does it save anything in the database or on the visitor’s device?
  18. Why is nothing sent on my test page?
  19. Is Clarity allowed on my site?
  20. Which Gravity Forms versions does it support?
  21. Get started

Video walkthrough

Gravity Forms Clarity and Hotjar: Send Form Events and Session Tags to Microsoft Clarity and Hotjar
Video tutorial: Gravity Forms Clarity and Hotjar Watch on YouTube

The Gravity Forms Clarity and Hotjar Premium Add-on tells Microsoft Clarity and Hotjar what happens to your Gravity Forms forms. It sends four things: that a form was shown, which page of a multi-page form the visitor reached, that the form was submitted, and that the visitor met a validation error. In Clarity they appear as custom events and session tags. In Hotjar they appear as events and recording tags. You can then filter session recordings and heatmaps by form and by step, and see where people stop.

It uses only the JavaScript of the two tools. It does not load their tracking code, it makes no call from your server, and it sends no field value unless you map a field yourself. Nothing is sent before the visitor has agreed.

What you need

  • WordPress 5.8 or newer and PHP 7.4 or newer.
  • Gravity Forms 2.5 or newer. The add-on is tested with Gravity Forms 3.1.2 on PHP 8.3 and Gravity Forms 2.9.8 on PHP 7.4.
  • The Microsoft Clarity tracking code, the Hotjar tracking code, or both, already installed on your site (their own plugins, Google Tag Manager or a code snippet).
  • An active license key for this add-on.

The add-on calls clarity("event", name) and clarity("set", key, value) from the Clarity client API, and hj("event", name) and hj("tagRecording", tags) from the Hotjar Events API (Hotjar reference). If a tool is not installed, its part is skipped without an error. If the tool loads late, the event waits for it for up to twenty seconds.

Install and activate

  1. Install and activate the add-on like any plugin, after Gravity Forms.
  2. Open Forms → Settings → Clarity and Hotjar and enter your license key.
  3. Choose where to send, what to send and how consent is checked (next sections).
The Clarity and Hotjar add-on settings in Gravity Forms: where to send, what to send (view, step, submission, error, tags) and the consent choices
The add-on settings: tools, events and consent.

Where to send

Switch Microsoft Clarity and Hotjar on or off. You can use one or both. The event name prefix is the start of every event name, gf by default. Track all forms is on by default; switch it off to track only the forms that you switch on one by one in their own settings.

What to send

Every event name is made of the prefix, the name of the form and the kind of event. For a form that is called booking, with the default prefix, the events are:

  • gf_booking_view: the form was shown. Sent once per page load.
  • gf_booking_step_2, gf_booking_step_3 and so on: the visitor reached that page of a multi-page form. Going back and forward again sends the step again.
  • gf_booking_submit: the form was submitted and the confirmation was shown.
  • gf_booking_error: the form came back with validation errors. A new failed try is a new event.
  • gf_booking_error_field_3: optional, one event for each field that has an error. Only the field number is sent.

Event names contain only letters, digits, underscores and dashes, up to 120 characters, so both tools accept them. Spaces become underscores and other characters are removed.

Session tags are on by default. Clarity gets the custom tags gf_form (the name of the form), gf_step (the page) and gf_status (viewed, step, error or submitted). Hotjar gets the same as recording tags, written as one word such as gf_status_viewed. With the tags you can filter recordings to the visitors who met an error on page 2, for example.

Error messages are never sent, and neither are field values. The browser console switch writes each call to the console of the visitor, which helps while you test.

The tools may need consent before they record, so the add-on waits for it. Choose how the add-on finds out:

  • WP Consent API (recommended): works with the consent banners that support the WP Consent API. Choose the category (Statistics by default). If the API is not on the site, the answer is no and nothing is sent.
  • A cookie set by my consent banner: give the cookie name and the value that means yes (several values separated by commas). If you leave the value empty, any value except no, false, 0, deny, denied, reject, rejected, refuse or refused counts as yes.
  • My own code: the add-on waits until your code calls GECH.grant() or sends the gech:consent event on the document.
  • No check: for sites that do not need consent. Use it only when that is true for your visitors.
The Consent part of the settings: consent check set to a cookie set by the consent banner, the cookie name and the cookie value that means yes
Consent: nothing is sent until the visitor has agreed.

Events that happen before consent are held in the memory of the page, at most 40 of them. When consent arrives, they are sent in order. If the visitor leaves without agreeing, they are gone: the add-on stores nothing in the browser (no cookie, no local storage) and sends nothing.

Settings for one form

Open a form and go to Settings → Clarity and Hotjar.

  • Track this form: follow the add-on setting, always, or never.
  • Name in event names: optional. The default is form plus the form number, such as form5. A readable name such as booking makes the reports easier to read.
  • Send these field values as tags: optional, see the next section.
The Clarity and Hotjar form settings: track this form, the name used in event names, and the field values to send as tags
Form settings: the name in event names and the optional tags.

Sending a field value on purpose

By default no field value leaves your site. If you want to segment recordings by a safe answer, such as the plan a visitor chose, write one line for each tag in the form settings, like this:

plan=3

This sends the value of field 3 as the tag plan, together with the submission event. The value is cut to 100 characters. You can map up to ten fields. Password, credit card, file upload, signature, list, captcha and image fields are never sent, even when mapped. The names gf_form, gf_step and gf_status are reserved. Map only values that you are allowed to share with the tool, and tell your visitors in your privacy policy.

Mapped values are sent with a confirmation that shows a message on the same page, with or without Ajax. With a redirect confirmation the submission event is sent, but mapped values are not, because the entry is no longer in the page.

Confirmations that redirect

When the confirmation redirects to another page of your own site, the add-on adds a small marker to the address, gech_done with the form number. The thank-you page sends the submission event and removes the marker from the address, so a reload does not send it twice. A redirect to another website cannot be followed, so the submission event is not sent for it. Use a message confirmation, or redirect to a page of your site that then forwards the visitor.

A worked example

A booking form has three pages: contact details, a date and a plan. You give it the name booking and map the plan field as plan=3. A visitor opens the page, fills in page 1, moves to page 2, leaves a required field empty and presses next. What the tools receive, in order:

  1. gf_booking_view, and the tags gf_form=booking, gf_step=1, gf_status=viewed.
  2. gf_booking_step_2, and the tags gf_step=2, gf_status=step.
  3. gf_booking_error, and the tag gf_status=error.
  4. After the visitor fixes the field and finishes: gf_booking_step_3 and then gf_booking_submit, with the tags gf_status=submitted and plan=Pro.

In Clarity, open the recordings, add a filter on the custom tag gf_status with the value error, and you watch exactly the sessions in which a visitor was stopped. In Hotjar, filter the recordings by the event or by the tag.

Testing your setup

  1. Open Forms → Settings → Clarity and Hotjar and switch on Write what is sent to the browser console.
  2. Open the page with the form in a private window and accept cookies in your banner.
  3. Open the browser console. Each call to a tool is written as a line that starts with GECH. If you see none, check the consent choice first, then check that the tool tracking code is on the page.
  4. Submit the form with a field left empty, then submit it correctly, and look at the lines again.
  5. Switch the console option off when you are done.

In the tools themselves, events can take a few minutes to appear. Clarity shows custom events with your other smart events in the filters, the dashboard and the recordings. Hotjar lists events in its events view and in the recording filters.

Privacy and good practice

  • Tell visitors about the tools in your privacy policy, and keep the consent check on unless your legal advice says it is not needed.
  • Keep tags free of personal data: names, email addresses, phone numbers and free text do not belong in a tag.
  • The tools mask what visitors type in forms by default. Do not switch that off for form pages.
  • The add-on never sends error messages, because a message can repeat what the visitor typed.

For developers

  • gech_form_config filters the settings that the script receives for a form. Return null to skip a form.
  • gech_blocked_field_types adds field types that are never sent as tags.
  • window.GECH.grant() and the gech:consent document event tell the add-on that consent was given, in the own code mode.

Frequently asked questions

Does the add-on install Clarity or Hotjar?

No. Install their tracking code the way you prefer. The add-on only sends events to the tools that are already on the page.

Does it work with cached pages?

Yes. The settings travel in the form markup and the consent is checked in the visitor’s browser, so a cached page works. The submission marker is part of the confirmation, which is never cached.

Does it save anything in the database or on the visitor’s device?

No. Its only stored data is the settings. It writes no cookie, no local storage and no session storage, and it makes no request to any website.

Why is nothing sent on my test page?

Most often the consent check says no. Switch on the browser console option, reload the page and look for lines that start with GECH. Also check that the tracking code of the tool is on the page.

Is Clarity allowed on my site?

Microsoft states that Clarity should not be used on websites that target users under 18. Check the rules of both tools for your audience.

Which Gravity Forms versions does it support?

Gravity Forms 2.5 and newer. It is tested with Gravity Forms 3.1.2 on PHP 8.3 and Gravity Forms 2.9.8 on PHP 7.4.

Get started

See where your visitors stop. The Gravity Forms Clarity and Hotjar Premium Add-on sends form events to Clarity and Hotjar in a few clicks, with consent and without field values. See the features, the price and the setup guide on the add-on page.

See the Clarity and Hotjar add-on

Still need help?

Our support team answers tickets every day, usually within a few hours.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr