Hubspot Server-Side Tracking

My website currently uses the Hubspot tracking code (installed via web GTM) to track user activity within Hubspot. However, because of ITP, any cookies set by Hubspot to track visitor activity (specifically ‘hubspotutk’ and ‘_hstc’) get deleted after 7 days even though they last for 6 months on other browsers like Chrome, according to Hubspot’s documentation.

I know Stape’s current server GTM Hubspot tag solution allows you to track things like custom behavioral events, but could I use it instead of relying on the Hubspot tracking code, without losing any functionality? For example: if someone uses Safari and visits my website on Day 1, and then they visit my website again on Day 14 and sign up with their email, I’d like to see the history of all of their activity back to Day 1 within Hubspot’s CRM. Is that possible with Stape’s current Hubspot tag?

Again, my end goal here is to get away from relying on the Hubspot tracking code installed via web GTM and switch to a server-side setup only. But in order to do that effectively, at least from my understanding, data from GTA4 client or Stape’s data client must send info to Hubspot’s tracking code API.

Am I understanding things correctly? Is that currently possible with Stape’s Hubspot tag? Or would it need to be updated?

hey @joshok7 you’re specific cookie problem can be addressed with sGTM in general, there are essentially 2 ways for it, depending on your circumstance, both are outlined here: Prolong first-party cookie lifetime set by a third-party IP - Stape

so it’s not the HubSpot tag that would be responsible for safari cookies being there for more than 7 days, but rather a combination of things. But with that done, so long as those cookies persist (people can still opt-out or just plain clean them) the activity from day 1 would be stitched to activity from day X

1 Like

So, I have a couple questions for each method outlined in the article you shared, because I’m really interested in doing one, possibly both, of them.


  • Is implementing this as easy as creating my own Cloudflare account and setting it up following the instructions in the article?

  • If I only did this option and not the Cookie Keeper option, would it extend the lifetime of Hubspot cookies on Safari? I think the answer would be ‘no’ since the Hubspot tracking code currently sets the cookies within web GTM, right? So I still have the issue of a cookie being set by JavaScript instead of from server GTM.

Cookie Keeper

  • Would Cookie Keeper work for the ‘hubspotutk’ and ‘_hstc’ cookies (if I have a business account and use the ‘add custom cookies’ feature)?

  • Based on the article, it looks like the master cookie’s unique ID value would be a hash of the user’s IP address + timestamp. Is that value the same one that would be restored for the ‘hubspotutk’ cookie and ‘_hstc’ cookie? I ask because in Hubspot’s documentation, it looks like the value of those cookies contain different information. If what I’m asking doesn’t make sense, it’s possible I’m misunderstanding exactly how the master cookie works. Maybe another way to ask this question is: Can I set my own value for the ‘hubspotutk’ and ‘_hstc’ cookies (which in this case, would be a hash of the user’s IP address + timestamp) and still expect those cookies to work properly with Hubspot? According to Hubspot documentation, the ‘hubspotutk’ cookie contains: an opaque GUID to represent the current visitor; and the ‘_hstc’ cookie contains: the domain, hubspotutk, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).

  • If I used Cookie Keeper and created my own custom cookies for it to set - in this case, ‘hubspotutk’ and ‘_hstc’, would I keep or remove the hubspot tracking code from web GTM? My concern is that the Hubspot tracking code in web GTM would overwrite cookies set from the server. I have the same concern for the Facebook pixel code installed via web GTM. I have a hybrid setup currently, so would I have to get rid of the pixel code installed via web GTM so the cookies that get re-set from the master server cookie are not overwritten?