Identify Tracking method not updating custom property

SOLVE
OnScaler
Participant

Hello!

 

I'm trying to identify and create a contact using the following code:

var _hsq = window._hsq = window._hsq || [];
                _hsq.push(["identify",{
                    email: emailAddress,
                    onscale_ip_country: ip_location.country_name,
                    onscale_ip_country_code: ip_location.country,
                    onscale_ip_state: ip_location.region,
                    onscale_ip_state_code: ip_location.region_code,
                    onscale_ip_city: ip_location.city,
                    onscale_ip_timezone: ip_location.timezone

                }]);
                _hsq.push(['trackPageView']);

I have created the custom onscale IP properties, however, I have not been able to update them for a newly created contact, nor have I been able to track the contact's lead (Organic Search, keywords, direct traffic, etc.).

 

The previous code I used was the following:

var _hsq = window._hsq = window._hsq || [];
                _hsq.push(["identify",{
                    email: emailAddress
                }]);
                _hsq.push(['trackPageView']);

This created the contact and tracked the lead properly, however, no IP location information was captured.

 

I should be able to pass in these custom properties (strings) according to the API guide here: https://developers.hubspot.com/docs/methods/tracking_code_api/identify_visitor

What am I missing with this implementation? I have casted the ip variables to strings as well. It seems as if adding custom properties makes the entire identify invalid.

 

Any help would be greatly appreciated.

 

Thanks!

0 Upvotes
1 Accepted solution

Accepted Solutions
WendyGoh
Solution
HubSpot Moderator

Hi @OnScaler,

 

I hope all is well with you 😄

 

I was able to create a new contact with the custom properties on one of your landing page:

identifyvisitor.png

 

In this case, I would expect the custom properties to be pass across if there's a value to it. Could you try passing in a testing variable onto the custom properties and see if it gets sent through? I'm not too sure how the ip_location is getting the user's location information, you can also try printing that out and check what's the value being passed across.

 

Additionally, I noticed there's a few IP address being included in your 'Exclude traffic' settings. Do take note that:

 

Once an IP address or referrer domain has been added to your excluded traffic, no visits, page views, submissions, or events data originating from that IP address or domain will be recorded in your HubSpot analytics.

 

Referencing this documentation: Exclude traffic from your site analytics

 

Let me know how it goes!

View solution in original post

2 Replies 2
WendyGoh
Solution
HubSpot Moderator

Hi @OnScaler,

 

I hope all is well with you 😄

 

I was able to create a new contact with the custom properties on one of your landing page:

identifyvisitor.png

 

In this case, I would expect the custom properties to be pass across if there's a value to it. Could you try passing in a testing variable onto the custom properties and see if it gets sent through? I'm not too sure how the ip_location is getting the user's location information, you can also try printing that out and check what's the value being passed across.

 

Additionally, I noticed there's a few IP address being included in your 'Exclude traffic' settings. Do take note that:

 

Once an IP address or referrer domain has been added to your excluded traffic, no visits, page views, submissions, or events data originating from that IP address or domain will be recorded in your HubSpot analytics.

 

Referencing this documentation: Exclude traffic from your site analytics

 

Let me know how it goes!

View solution in original post

OnScaler
Participant

Hi Wendy!

 

That helped a lot, turns out there was some tracking prevention going on in my browser that prevented these calls from being made my localhost. Once I deployed to a test server the contacts seemed to record the IP properly!

 

Thank you for your help!

 

0 Upvotes