Hubspot: Identify, Track, Page

I understand that page() must be called after identify() to flush contact properties to Hubspot.


(1) If we include contact properties within a track() call is a page() still required following?

We're specifically looking at the "Setting Contact Properties on Track" in the documentation for Hubspot:


(2) If a page() call is still required, is there a best practice for using this in a single-page app?  It seems like we'd be double counting page views.  Do you recommend setting a "success" page view (i.e. for a form submission), even if there's no new page?

Thank you!

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • HI Mike Weber ,

    Good questions!

    I first want to take a step back and describe the two different types of Hubspot Destinations we have:
    Cloud-based (server-side) and Device-based (client-side).

    If you connect the Hubspot destination to a Server Source (such as Node or Python), Segment will use a different API than if you connect the Hubspot Destination to a client-side source (Analytics.js).

    Specifically, for the track() call, Segment uses the Hubspot JS API for client-side sources and the Hubspot HTTP API for server-side sources. As can be seen in the linked documentation, updating contact traits via the track call is only available via the HTTP API.

    Thus, you will only be able to update Contact Traits in Hubspot with the Track call if you hook up the Hubspot Destination to a Server-side Source. With Segment's server-side integration with Hubspot, no "flushing" is required. So, to finally answer your question:
    Question: If we include contact properties within a track() call is a page() still required following?
    Answer: No. You can only update contact properties via a server-side call. Server-side calls do not require a page() call to flush the updated user traits.


    I know the above is not very clear in our documentation. I will pass this along internally so we can make an update.


    So, moving back to your use-case (and assuming you are using the Client-side Hubspot integration), instead of trying to push user traits with the track call, first make an identify call that updates the traits and then make the same track call (minus the user traits). A track call will also "flush" identify calls just like page calls do. 

    To quote Hubspot's Documentation:
    "Keep in mind that the identify function only sets the identities in the tracker.  The identities do not get passed to HubSpot until you make a separate trackPageView or trackEvent call."

    The above documentation has additional recommendations for page tracking with Single-Page Apps, as well!


    Phew, I know that was a lot of information (and took a good amount of investigation on my end, too!). Please let me know if I can clarify anything.

    Reply Upvote
  • Will Allison Hi Will! Thanks for your comment on this one. It's still pretty unclear in the original docs and while it gets updated, I'd like to ask some questions.

    1) You mention "...assuming you are using the Client-side Hubspot integration" – to me it seems we can't even choose between client-side or server-side destinations.
    2) It's a bit unclear how your described solution would work in the following scenario:
    - Anonymous user visits a landing page
    - Fills in a "request a trial" form
    - Client-side fires .identify, which, as it seems, does not create a contact in Hubspot
    From here on how should we set up the following steps to record a contact?
    Do we still need to call out .page() or can we / do we have to do a .track(). In the latter case, we would need to add an event name, but identify doesn't have an event name, which is confusing, because you say "first make an identify call that updates the traits and then make the same track call (minus the user traits)"


    I tried something like this

      /// Traits
      /// Options
      integrations: {
          All: false,
          HubSpot: true,
          Webhooks: true
    () => {
        analytics.track('formSubmission', {
        integrations: {
          All: false,
          HubSpot: true
    Reply Upvote