Push custom properties to hubspot dashboard through identify visitor tracking code



Hi mates, i want to ask about how i can update my customer and customer company data through javascript api.
I read Hubspot Developer API and try to pass customer and company custom field. and it’s says that possible to push / update customer data to hubspot dashboard.

here’s my simple code to push the data. i use jade template to handle the script.
// my code
var hsq = window.hsq = window.hsq || [];
email: “#{req.user.email}”, // Email address
id : "#{
.result(req, 'user.id’)}", // user_id
firstname: "#{
.result(req, ‘user.firstname’)}", // Full name
lastname: "#{
.result(req, ‘user.lastname’)}",
mobilephone: "#{
.result(req, ‘user.phone’)}",
workingEmail: “#{req.user.workingEmail}”, // Email address
user_created_date: "#{ Math.floor( new Date(
.result(req.user, ‘company.createdAt’, new Date().toISOString() )).getTime() / 1000 ) }", // company created at
companyid: “#{.result(req, 'user.company.id’)}",
company: "#{
.result(req, ‘user.company.name’)}",
current_plan: "#{
.result(req, ‘user.company.plan’)}”,
createdate: “#{ Math.floor( new Date(.result(req.user, ‘company.createdAt’, new Date().toISOString() )).getTime() / 1000 ) }",
recent_deal_amount: "#{
.result(CONFIG.subscriptionPlan[.result(req, ‘user.company.plan’)], ‘payments.monthly.idr’)}",
trial_extend_count: "#{
.result(req, ‘user.company.trial_extend_count’, 0)}”,
plan_trial_expired_date: “#{ Math.floor( new Date(.result(req.user, ‘company.plan_trial_expired_date’, new Date().toISOString() )).getTime() / 1000 )}",
current_plan_start_date: "#{ Math.floor( new Date(
.result(req.user, ‘company.plan_first_date’, new Date().toISOString() )).getTime() / 1000 )}”,
monthly_spend_idr : “#{.result(CONFIG.subscriptionPlan[.result(req, ‘user.company.plan’)], ‘payments.monthly.idr’)}”,
monthly_spend_usd : “#{.result(CONFIG.subscriptionPlan[.result(req, ‘user.company.plan’)], ‘payments.monthly.usd’)}”,
phone : “#{.result(req, ‘user.company.phone’)}",
website : "#{
.result(req, ‘user.company.website_url’)}”,
current_plan_start_date : “#{ Math.floor( new Date(.result(req.user, ‘company.plan_start_date’, new Date().toISOString() )).getTime() / 1000 )}",
current_plan_expired_date : "#{ Math.floor( new Date(
.result(req.user, ‘company.payment.expired’, new Date().toISOString() )).getTime() / 1000 )}”,
urbanhire_career_page : “http://jobs.urbanhire.com/#{.result(req, ‘user.company.subdomain’)}",
industry : "#{
.result(req, ‘user.company.company_industry’)}”,
company_size: “#{companySizeName}”,
total_jobs : “#{totalJob}”,
jobs_published: “#{jobPublish}”,
job_closed: “#{jobClosed}”,
job_draft: “#{jobDraft}”,
hiring_urgency: “#{.result(req, ‘user.company.urgency’, ‘’)}",
hiring_projection: "#{
.result(req, ‘user.company.projection’, ‘’)}”

    // push which page very productive on dashboard
    var page = (location.pathname).split('/')
    var pageName = (page[1]) ? page[1] : location.pathname
    _hsq.push(['setPath', '/' + pageName]);

after that i put hubspot tracker. bellow that.
// push which page very productive on dashboard
script(type=“text/javascript” id=“hs-script-loader” async defer src="//js.hs-scripts.com/xxxxxxx.js")
For the custom field, i’ve already added to contact properties and company properties.

The script already deployed to production server, and after several time try to login and none of the data show up on my dashboard.

i assume that my code wasn’t error, any body can help here?



hi @jeprisinaga,

A few things jump out to me here:

  1. Can you show an example output on a live page (rather than the jade template code)?
  2. In terms of synchronicity, are you certain that your JS is running before the analytics tracking script loads?
  3. If not, are you making any subsequent ‘trackEvent’ or ‘trackPageView’ calls? (described here: https://developers.hubspot.com/docs/methods/tracking_code_api/track_page_view and here: https://developers.hubspot.com/docs/methods/tracking_code_api/javascript_events_api) - the trackPageView call must run after the identify call, or you must call trackPageView again.
  4. One item in the code that jumped out to me was the inclusion of ‘createdate’ - that would match a read-only property in HubSpot, which could throw an error when the HubSpot analytics server processes this call. Can you remove that and try the call again?




Hi @robert

thanks for the reply, here is my explaination.

  1. Bellow my production live code.

2 if you check code that i posted, i trully sure my code have no problem before tracking code loaded.
3 Yes, i need to push current page that user access during login/sign up session.
4 i assume that createddate cannot be sync/push from identify event?

thanks robert


Helo @Robert_Ainslie can you help my reply.

very appreciated


hi @jeprisinaga,

Do you have a live page I can look at and/or a way to test? Feel free to DM me if you don’t want that inline in the forum post. (Also, am I able to test this on page load, or is the ‘identify’ call only made if you’re logged in?)

The code looks OK other than the inclusion of ‘createdate’. ‘createdate’ cannot be set by sync/push - it is only set as a system property by HubSpot when the contact is actually created. Can you remove that in production?



Hi @Robert_Ainslie, did you have any email so i can invite you to the apps? so you can checking it live.
noted for createdate, i can remove it directly.
btw how can i DM directly to you?

  • thanks


Hi @jeprisinaga,

You can send a DM by clicking on the username in the message thread and choosing ‘Message’.

I’ll send you a DM now with my email address.