• Learn how AI and automation actually work in your Help Desk. Ask our experts how to improve team speed and customer happiness! AMA Nov 17-21.

    Ask us anything

APIs & Integrations

DB1434
Member

Identify user on the survey service

SOLVE

Hi. I'm trying to implement a survey on my website.

I want the survey to know before loading what is the identity of the user.

 

So I implemented something like that: 

DB1434_1-1636280204353.png

 

that's happening before HubSpot's code is loaded.

But, the result is that after the user fill's up the survey - He is asked about his Email:

DB1434_2-1636280322321.png

This means - as I can understand it - that the survey didn't get my Identity.

Is there any way to make it know the uset's email?

0 Upvotes
1 Accepted solution
dbeau79
Solution
Contributor | Platinum Partner
Contributor | Platinum Partner

Identify user on the survey service

SOLVE

@StefanPopescu , it seems like the survey is probably loading before you are identifying the visitor.  Do you agree with that?  Possible to identify the visitor and then reload the tracking code?  In the tracking code api overview HubSpot lists an example for tracking in single-page apps.  It's not for your specific use case but it does seem relevant.  You may be doing this already but are you loading the tracking code after you're identifying the visitor ... and with the async/defer parameters?

I'm referencing the code block in the "Tracking in single-page applications" here: https://developers.hubspot.com/docs/api/events/tracking-code.

View solution in original post

7 Replies 7
dbeau79
Solution
Contributor | Platinum Partner
Contributor | Platinum Partner

Identify user on the survey service

SOLVE

@StefanPopescu , it seems like the survey is probably loading before you are identifying the visitor.  Do you agree with that?  Possible to identify the visitor and then reload the tracking code?  In the tracking code api overview HubSpot lists an example for tracking in single-page apps.  It's not for your specific use case but it does seem relevant.  You may be doing this already but are you loading the tracking code after you're identifying the visitor ... and with the async/defer parameters?

I'm referencing the code block in the "Tracking in single-page applications" here: https://developers.hubspot.com/docs/api/events/tracking-code.

dbeau79
Contributor | Platinum Partner
Contributor | Platinum Partner

Identify user on the survey service

SOLVE

@DB1434 @StefanPopescu  This may have been what you were referring to in #2 but have you tried this? https://legacydocs.hubspot.com/docs/methods/tracking_code_api/identify_visitor ... seems like the example in the code block is exactly what you're looking for.  Although, I don't know how you're identifying the visitor's email address.

StefanPopescu
Member

Identify user on the survey service

SOLVE

Hi @dbeau79 thanks for your answer, this is exactly what we did:

                    var _hsq = window._hsq = window._hsq || [];
                    _hsq.push(["identify",{
                        email: _form.email.value
                    }]);
                    _hsq.push(["trackEvent", {
                        id: "Registration"
                    }]);
But this did not solved our issue. Still the visitor is not identified. What else should we check/do here?
 
Thanks,
Stefan.

 

0 Upvotes
DB1434
Member

Identify user on the survey service

SOLVE

Hi @dbeau79,

 

We've created a Feedback survey in the Service hub, not a conversation.

The survey is a simple CSAT as per the options hubspot provides (so no HubL involved at all).

The problem is basically that the customer never meets a hubspot-generated form on the client anywhere on the way, so the Hubspot cookie contains no identification of the visitor to my platform.

Unfortunately I cannot provide access to my platform, however what we are trying to accomplish is that when the page loads and the feedback survey js is loading - it will already have the visitor's identity so that when I set "Audience" rules they can actually apply based on the single visitor to the page.

 

We've so far attempted 2 methods to passing on this identification to the form:

1. Conversation API identification.

2. Tracking API identification (by creating a custom event upon registration and passing the contact id ('vid') on the identification of the event.

 

Is there a way to set the customer's identity on the Hubspot Cookie without the customer filling out a hubspot-generated form?

 

 

I'm also tagging  @StefanPopescu our developer who can work with you and provide code samples.

Thank you so much for your help!

dbeau79
Contributor | Platinum Partner
Contributor | Platinum Partner

Identify user on the survey service

SOLVE

@DB1434 , let me start by saying I don't know, but I'd like to help out. Are you using Feeback Surveys or Conversations to build this survey?  I'm guessing HubL isn't an option here... {{ contact.email }}?  Could you share a link to the page?

natsumimori
Community Manager
Community Manager

Identify user on the survey service

SOLVE

Thank you @dbeau79 !

0 Upvotes
natsumimori
Community Manager
Community Manager

Identify user on the survey service

SOLVE

Hi @DB1434 , thank you for your post.

 

I wanted to tag in @Indra and @dbeau79 who have shared great knowledge around custom development. Would you be able to weigh in here? 

0 Upvotes