APIs & Integrations

Not applicable

Identify method not updating non email contact properties

SOLVE

I am attempting to update contact properties using _hsq.push(["identify"]) as documented but I am finding that it will only create contacts and add email, other properties are ignored.

as a test I am running code like this

_hsq.push(["identify",{
email: "testman123456hubspot@yahoo.com",
firstname: 'orange'
}]);

and then to push it to hubspot

_hsq.push(["trackEvent", {
    id: "User Identified"
}])

The contact is created with my email, but firstname and any other property, custom or not is ignored. Any clue what Im doing wrong here?

0 Upvotes
2 Accepted solutions
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Identify method not updating non email contact properties

SOLVE

Hey, @peterlazzarino.

Thanks for all that information.

I tried a few times to create contacts with firstname and lastname values through the console, but this record was only created upon completing step 7. The same code executed perfectly on my own site's console...

I'm not quite sure what's going on there, but I'd like to explore alternatives for a second. Is there a reason why you're attempting to use the identify function instead of the Forms API? On the surface, the Forms API seems like a much better fit for the kind of information you're gathering and trying to pass to HubSpot.

To be transparent, I'll be heading on vacation shortly, so I may miss your responses. While I'm out of office next week, my teammates @Derek_Gervais and @Connor_Barley will be keeping an eye on my ongoing threads.

Isaac Takushi

Associate Certification Manager

View solution in original post

0 Upvotes
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Identify method not updating non email contact properties

SOLVE

Hey, @randyCg.

 

My most recent test went through successfully! Here is the resulting contact record.

 

Are you testing on an unfiltered IP?

 

If you're using your normal browser on your organization's network or VPN, the analytics events are likely being excluded from your account. Whenever I test HubSpot analytics functionality, I use Opera in VPN mode.

Isaac Takushi

Associate Certification Manager

View solution in original post

18 Replies 18
Not applicable

Identify method not updating non email contact properties

SOLVE

Alright I'll give it a try, thanks!

IsaacTakushi
HubSpot Employee
HubSpot Employee

Identify method not updating non email contact properties

SOLVE

Hey, @peterlazzarino.

Ah, gotcha.

Nope, the Forms API doesn't require any authentication. You can just gather the desired field values, format them into JSON, and shoot them to the endpoint. You will need to create a HubSpot "copy" of your Squarespace form with a unique formGuid to receive these submissions.

Isaac Takushi

Associate Certification Manager
0 Upvotes
randyCg
Member

Identify method not updating non email contact properties

SOLVE

Hi Isaac,

 

I'm trying to do something similiar... having a similar problem.  When I ran your test script, the data flowed into a Hubspot contact record.

<script>
 var _hsq = window._hsq = window._hsq || []
    _hsq.push(['identify', {
        email: 'identify_test_email_3@hubspot.com',
        firstname: 'Test FN 1',
        lastname: 'Test LN 2'
    }]);
    _hsq.push(['trackPageView'])
</script>


However when I insert the variables (see image below), nothing happens.

 

I'm simply trying to implement shopping cart abandonment mitigation with a workflow in Hubspot. I just need to push the data (name, email, page visited, etc.) from the external platform into Hubspot.  

The external platform is not using a Hubspot form, and the HS tracking script is on every page of the external platform.

 

Here's a snapshot of the script in the external platform... 2 steps... Contact Info (page 1) and Payment Info (page 2)

 

2020-05-19_16-21-16.png


Any ideas would be appreciated. 


0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Identify method not updating non email contact properties

SOLVE

Hi, @randyCg.

 

Thanks for reaching out!

 

Can you tell me a bit more about the variables you're using? Are they Handlebars.js variables? If you log those variables to the console within those "Checkout Scripts" snippets, do they populate with known values?

 

(HubSpot's HubL templating language also uses the {{variable}} syntax, so I want to be sure that's not what you're trying to do.)

 

In the Network tab on the checkout pages, do you see any GET requests to https://track.hubspot.com/__ptq.gif? If so, can you share sample request URLs below? The information passed in the identify function should populate an i parameter like the example below for "Aaron Burr":

 

https://track.hubspot.com/__ptq.gif?k=1&sd=2560x1440&cd=24-bit&cs=UTF-8&ln=en-us&bfp=3721579748&v=1.1&a=2676635&pi=4623992295&ct=standard-page&ccu=https%3A%2F%2Fwww.example.com&cpi=4623992295&lpi=4623992295&lvi=4623992295&lvc=en&pu=https%3A%2F%2Fwww.example.com%2F&t=Home&cts=1590006322395&i=email%3Daburr%2540hubspot.com%26firstname%3DAaron%26lastname%3DBurr&vi=77944bdff1d883743e21c6743a17b0b2&nc=true&u=18168806.77944bdff1d883743e21c6743a17b0b2.1590006141552.1590006141552.1590006141552.1&b=18168806.1.1590006141552&pt=1

Isaac Takushi

Associate Certification Manager
0 Upvotes
randyCg
Member

Identify method not updating non email contact properties

SOLVE

Hi Issac,

 

I'm a bit new to JS, still learning. Not sure about Handlebars.js or not. 

 

I don't  see any GET requests either.

 

 

When I run the inspector on the page, I see the data is showing up in the right places... and it's correct... 

2020-05-20_18-49-14.png

 

But , it never makes it into Hubspot Contacts.  

 

However, when I put static data in by hand, it did save it in HS Contacts... which is why I'm baffled...

 

Test Data.png

 

And here's the URL from that page 

https://learn.duarte.com/orders?cart=%5B%7B%22purchasableId%22%3A%22049f6ec6-ac88-467b-a8d0-9541748a...

 

 

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Identify method not updating non email contact properties

SOLVE

Thanks for sharing all this information, @randyCg!

 

Based on your description of the issue, I suspect the variables aren't populating the email and other property values by the time the identify function triggers. (The inspector may not be telling the full story in real time.)

Do you mind if I run some tests too?

 

Depending on what I find, we may need to reach out to Thought Industries. They document and recommend the use of these Handlebars.js and HubL-like variables but the article doesn't say exactly how and when they're filled.

Isaac Takushi

Associate Certification Manager
0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Identify method not updating non email contact properties

SOLVE

Hey, @randyCg.

 

No worries.

 

I ran a couple tests on the "Contact Info" page and I actually do see GET requests to https://track.hubspot.com/__ptq.gif.

 

Here's one example:

https://track.hubspot.com/__ptq.gif?k=1&sd=2560x1440&cd=24-bit&cs=UTF-8&ln=en-us&bfp=39444228&v=1.1&a=1619981&pu=https%3A%2F%2Flearn.duarte.com%2Forders%3Fcart%3D%255B%257B%2522purchasableId%2522%253A%2522049f6ec6-ac88-467b-a8d0-9541748ab785%2522%252C%2522purchasableType%2522%253A%2522course%2522%252C%2522quantity%2522%253A1%252C%2522isBulkPurchase%2522%253Afalse%252C%2522priceInCents%2522%253A12900%257D%255D&t=Duarte&cts=1590064026503&i=email%3Dtest3%2540HSQ1.com%26firstname%3DStep%2B2%26lastname%3DPayment%2BInfo&vi=9f8ca2bd3c2c6b998d61f79995fccb20&nc=true&u=135523374.9f8ca2bd3c2c6b998d61f79995fccb20.1590063808008.1590063808008.1590063808008.1&b=135523374.1.1590063808008

Notice how the i parameter contains information for email, firstname, and lastname:

i=email%3Dtest3%2540HSQ1.com%26firstname%3DStep%2B2%26lastname%3DPayment%2BInfo

Unencoded, that comes out as:

i=email=test3%40HSQ1.com&firstname=Step+2&lastname=Payment+Info

My tests consistently yielded these values. When unencoded a second time, they are:

email=test3@HSQ1.com
firstname=Step 2
lastname=Payment Info

These are not the values which I submitted in the form, so there is some disconnect between what is being typed and what is being sent in the identify function.

 

Does the test3@HSQ1.com email ring a bell? Could it be hard coded anywhere else on your site?

 

Finally, I tried to inspect both the "Contact Info" page shared above and the page I land on after submitting it to locate the identify function with the variables filled, but I'm not seeing it. Can you walk me through exactly how you reached this view?

 

2020-05-20_18-49-14.png

Isaac Takushi

Associate Certification Manager
0 Upvotes
randyCg
Member

Identify method not updating non email contact properties

SOLVE

Hi Isaac,

 

I was running various tests last night, looking at the inspector.  My last test was a hardcoded test using the email test3@hsq1.com, and it did end up appearing in contacts. 

I just switched the JS back to

 

<script>

var _hsq = window._hsq = window._hsq || [];

       _hsq.push(['identify', {

             email: '{{email}}',

             firstname: '{{firstName}}',

             lastname: '{{lastName}}'

      }]);

     _hsq.push(['trackPageView'])

</script>

 

If you could try your tests again, I'm going to do the same.

 

As for the view... 

 

Step 1:  https://learn.duarte.com/catalog  (selected a course)

Step 2:  Course page, selected ENROLL NOW

Step 3:  Clicked CHECKOUT

Step 4:  Entered contact information

Step 5:  Cliecked ENTER PAYMENT INFORMATION

Step 6:  On the Payment Information Page I turned on the INSPECTOR and searched for HSQ

 

2020-05-21_07-53-27.png

 

 

Thanks!

0 Upvotes
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Identify method not updating non email contact properties

SOLVE

Hey, @randyCg.

 

My most recent test went through successfully! Here is the resulting contact record.

 

Are you testing on an unfiltered IP?

 

If you're using your normal browser on your organization's network or VPN, the analytics events are likely being excluded from your account. Whenever I test HubSpot analytics functionality, I use Opera in VPN mode.

Isaac Takushi

Associate Certification Manager
randyCg
Member

Identify method not updating non email contact properties

SOLVE

Thanks Issac. 

 

It's working for me!  Thank you very much!

Not applicable

Identify method not updating non email contact properties

SOLVE

Hi Isaac,

I have been able to successfully create them through my console but only after triggering an event.

I have not really explored the forms API option. Does it require authentication with OAuth? I wanted to keep our hubspot dependency on these pages as lightweight as possible.

0 Upvotes
IsaacTakushi
Solution
HubSpot Employee
HubSpot Employee

Identify method not updating non email contact properties

SOLVE

Hey, @peterlazzarino.

Thanks for all that information.

I tried a few times to create contacts with firstname and lastname values through the console, but this record was only created upon completing step 7. The same code executed perfectly on my own site's console...

I'm not quite sure what's going on there, but I'd like to explore alternatives for a second. Is there a reason why you're attempting to use the identify function instead of the Forms API? On the surface, the Forms API seems like a much better fit for the kind of information you're gathering and trying to pass to HubSpot.

To be transparent, I'll be heading on vacation shortly, so I may miss your responses. While I'm out of office next week, my teammates @Derek_Gervais and @Connor_Barley will be keeping an eye on my ongoing threads.

Isaac Takushi

Associate Certification Manager
0 Upvotes
randyCg
Member

Identify method not updating non email contact properties

SOLVE

Hi Isaac, thank you for connecting!

 

I'm just getting into JS, so I'm not yet completely up to speed on it.  I'm not doing anything with handlebars.js.  I was given these 2 boxes in the external platform where they trigger on a page visit, where I can send data via JS to HubSpot.  

https://knowledgecenter.thoughtindustries.com/learn/article/tracking-scripts

https://www.thoughtindustries.com/support/hubspot-integration

 

You can see those 2 boxes and my JS code in each one. 

 

When I visit the site, and select a course to purchase... I fill out my contact information on page 1, and then proceed to the credit card page... and abandon the cart.  

 

It's at that moment that the script should fire off and send the information to Hubspot. 

 

I don't see a URL as you've spec'd... only the shopping cart URL 

 

Link to a course purchase page

https://learn.duarte.com/courses/slide-design-lab

 

Link on the CC page when I abandon the cart without entering in the CC info...

https://learn.duarte.com/orders?cart=%5B%7B%22purchasableId%22%3A%22afe5dbfc-67a8-4a9a-9222-fc0e37d0...

 

 

 

0 Upvotes
Not applicable

Identify method not updating non email contact properties

SOLVE

Also Isaac, just realized that our production code does not include first and lastname fields. I have been testing by dropping your examples into the console until I can get this working. You should be able to do the same on that step or even the first step since the hubspot tracking script is loaded on every page.

0 Upvotes
Not applicable

Identify method not updating non email contact properties

SOLVE

Hey Isaac,

Thanks for the help so far. It seems your code is essentially the same as mine except for the email variable which is dynamic in my case.

I just created a contact using the code I provided above and its located here https://app.hubspot.com/contacts/2416790/contact/163846001/?interaction=note

my hubspot username is peter@collegevine.com

The url where this is active is https://my.collegevine.com/start, you can go through the wizard with dummy data if you'd like for testing purposes. The event is sent to hubspot after Step 7 / email address entry when next is hit.

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Identify method not updating non email contact properties

SOLVE

Hey, @peterlazzarino.

Strange. A very slight modification of that code worked for me:

<script>
 var _hsq = window._hsq = window._hsq || []
    _hsq.push(['identify', {
        email: 'identify_test_email_3@hubspot.com',
        firstname: 'Test FN 1',
        lastname: 'Test LN 2'
    }]);
    _hsq.push(['trackPageView'])
</script>

Could you share a link to a page with this code on it that I could test? Additionally, could you send me a link to that contact record (or a similar one showing the issue)?

Finally, are you saying that trackPageView on its own doesn't create the contact for you? Per the identify function's documentation, either the trackPageView or trackEvent should work — you don't need to use both.

Isaac Takushi

Associate Certification Manager
0 Upvotes
Not applicable

Identify method not updating non email contact properties

SOLVE

I've just modified my code based on the example you've provided with no luck. I am sending firstname and lastname and neither get updated. Also in your example there was no trackEvent, but contacts won't update on my end without sending a trackEvent. Is there anything specific to my account or setup that could be happening here?

    var _hsq = window._hsq = window._hsq || []
    _hsq.push(['identify', {
        email: email,
        firstname: 'Test FN',
        lastname: 'Test LN'
    }]);
    _hsq.push(['trackPageView'])
    _hsq.push(['trackEvent', {
        id: "User Identified"
    }])

Attaching an image of the user, I did also check in all properties to verify the ones I am sending are blank.

19%20AM

0 Upvotes
IsaacTakushi
HubSpot Employee
HubSpot Employee

Identify method not updating non email contact properties

SOLVE

Welcome, @peterlazzarino.

I successfully created this contact:

with the following script embedded directly on one of my web pages:

<script>
var _hsq = window._hsq = window._hsq || [];
_hsq.push(["identify",{
    email: 'identify_test_email_1@hubspot.com',
    firstname: 'Identify Test Email 1',
    lastname: 'From Page 2'
}]);
_hsq.push(['trackPageView']);
</script>

In your test code, you've placed the email value within double quotes while the firstname property value is in single quotes. I wonder, if you only use single quotes, does it make a difference?

Also, would you mind trying to place var _hsq = window._hsq = window._hsq || []; just before the identify method?

Isaac Takushi

Associate Certification Manager
0 Upvotes