We want to collect feedback about our product from customers using your Feedback Surveys option.
However, we want to know who sent us the feedback and avoid receiving anonymous opinions.
To achieve this, we pass the user’s email as per HubSpot documentation.
Unfortunately, we have encountered instability with this method. Sometimes, the email is transmitted and identified correctly, but Feedback Surveys still requests the email
Conditions of the Issue:
The issue with the email prompt primarily occurs when a user accesses our platform for the first time. If the user navigates to another page after the initial load, the issue does not reoccur. During our troubleshooting, we added a timeout for the script loading and processing and ensured the script execution happens after the initial load. However, this solution has also proven to be unstable.
More details:
After integrating the HubSpot Tracking Code, the following occurs:
-
Sometimes the form works correctly, sending data and displaying the message “Thanks so much.”
-
Sometimes the form prompts for an email input, despite the email being passed via the line _hsq.push([‘identify’, { email: “#{User.current.email}” }]);.
The problem is inconsistent: sometimes the form works correctly, and sometimes it asks for an email input even though HubSpot always receives the user data.
Steps Taken:
- Script Loading Check:
- Verified that the HubSpot script loads without errors through the browser’s developer console.
- User Identification Check:
- Ensured that the line _hsq.push([‘identify’, { email: “#{User.current.email}” }]); correctly substitutes the current user’s email.
- Asynchronous Script Loading:
- Tried different script loading methods, including loading the script after the page fully loads using window.addEventListener(‘load’, …).
- Adding Logs and Debugging:
- Added console logs to verify that the user identification is performed correctly each time it is needed.
- Session and User State Check:
- Ensured that the current user’s state updates correctly on all application pages, especially after login.
Results:
None of the above steps led to a stable resolution of the problem. The form continues to malfunction, requiring the user’s email input despite these details being passed to HubSpot. When navigating through pages, the script reloads, and the form starts working correctly, adding to its inconsistent behavior.

