Hubspotutk cookie in Angular 7 App


#24

Hi @Connor_Barley -- I tried what you suggested but could not repro your results. I have rebuilt and redeployed our Angular 7 SPA to append the query parameters to the setPath as you requested and as you can see in the attached screenshot. You can see the po parameter formatted like you did in the call to the https://track.hubspot.com/__ptq.gif endpoint.

TBH, this approach doesn't make sense on at least three counts:

  1. There's nothing in the docs that says anything about formatting the setPath in this way. If in fact it were so, every HS customer that used an SPA would fail in the same way.

  2. Surely it doesn't make any sense for the https://track.hubspot.com/__ptq.gif endpoint to have to decode and reinterpret the _hsenc parameter when it has already been done by the tracking code? That's where the a and vl parameters come from, for example.

  3. If this approach were necessary, why bother with the hubspotutk cookie at all? It plays no role in the scenario you outlined. Rather, as I have shown, the value of the hubspotutk token is echoed in the vl parameter. The problem is that no page views are recorded.

Is it time for a new approach? We've been battling this problem for 3 weeks. We've paid for Enterprise support. The marketing people are not happy at all because they can't send a mass mailing without this tracking info working. What do I do to escalate the problem? I'm fully prepared to believe I'm doing something wrong. But it isn't in the docs and no one can tell me what it is.


#25

Hi @mflorence99, I totally feel your pain here, this has been a long and arduous journey. I'll be your best point of contact as I'm speaking directly with our product team and partnering with other folks internally. I think the issue is a conglomerate of compounding factors that have made it confusing to follow properly as well as troubleshoot.

First and foremost, I think there's a definite flaw in the documentation on this method. We're working currently on an audit of all of our docs and this one will be at the top of the list.

  1. I believe there's nothing in the docs aside from a small example in the right-hand side here: https://developers.hubspot.com/docs/methods/tracking_code_api/set_page_path.
  2. The way it works is that the tracking code sets a cookie in a user's browser. A page view activity gets recorded by the tracking code (ptq) and sent to our tracking servers. The activity includes a field with the cookie value (vi). If that cookie matches a usertoken that's associated already with a contact record, that view gets associated with that contact and appears on their timeline. The way the browser cookie and contact record would get associated is when a page view happens on a URL that includes _hsenc, that view activity tells HubSpot to associate the vi cookie value on that activity with the contact whose email address the _hsenc value decodes to. So if we get a view activity and the URL (pulled from the po param in your case) includes the _hsenc parameter, we will decode it, find that vid, and then if the cookie on that activity is not already associated with that vid (or with any other vid) we will associate it. The issue was that since the _hsenc parameter was not being sent in the po parameter, we couldn't make the association. a page view was being recorded, but since nothing had happened to associate the browser cookie with my contact record the views couldn't be associated with it.

Currently, because your po field is property formatted, I'm getting page views on my contact: https://app.hubspot.com/contacts/1859609/contact/15198451/?interaction=note. Same thing for my colleague: https://app.hubspot.com/contacts/1859609/contact/15534101/?interaction=note. Setting the path with query strings included looks to have solved the issue.


#26

I'm sorry @Connor_Barley we're still going nowhere. None of that helps because I can't repro your results.

I just tried again. I sent this email https://app.hubspot.com/email/1859609/details/6406760335/recipients/clicked to me on behalf of contact Liz Perry. No page view information is observed, yet the po parameter is formatted just as you wanted.

Nothing whatsoever solved. Perhaps you still have cookies set from when you were using your test application, not mine. I can only repeat: it does not work.

How do we escalate this problem?


#27

@mflorence99, can you please conduct your tests on a VPN such as through the Opera browser? IP filtering could be causing an issue.


#28

@Connor_Barley I have not yet balked at any of the tests you've asked me to run, but this one is a step too far. Do you mean that all our users must use a VPN via Opera to get page tracking? Surely not.

Show me the config setting on our account first that filters by IP. Then we can see if my IP is being filtered. I just ran whoami.com and my IP is 173.209.111.70.

Have you run the exact same test as me? Send this email https://app.hubspot.com/email/1859609/details/6406760335/recipients/clicked to yourself on behalf of Liz Perry. Copy the CTA link and paste into a browser with the Network tab showing. Observe if any page view activity on https://app.hubspot.com/contacts/1859609/contact/5394701/?interaction=note (Liz Perry).


#29

hi @mflorence99, I understand the frustration and I really appreciate the timely alterations you've made to your app so we can test. I just tested my contact and I have more page views: https://app.hubspot.com/contacts/1859609/contact/15198451/?interaction=note


#30

@Connor_Barley That's great but maybe you have a cookie left over from when you were running against your test app.

Why don't you run my test? If it works for you, but not for me, then we can look at what might be different.


#31

Hi @mflorence99, just did your test by sending a test email and previewing as Liz Perry. Is this what you're wanting me to to do a la -- http://prntscr.com/lqr3x3? If so, that doesn't work as the _hsenc parameter, if you decode it, is still the receivers email address. You can see this here:

This was after I sent the email to myself previewing as Liz Perry > copied the URL, opened the Network tab, confirmed a ptq event, and checked Liz Perry's contact timeline. More page views showed on mine: https://app.hubspot.com/contacts/1859609/contact/15198451/?interaction=note


#32

OK @Connor_Barley now we are getting somewhere. I don't have the magic app that decodes the _hsenc -- but how on earth do I get an email sent to me on behalf of a third party so I can test?

What does it mean in the test send "receive on behalf of" if the CTA link isn't to that person?


#33

Hey @mflorence99, if you have some sort of personal or alternate email address, what you can do is create a new contact in your portal like my test ones, send a test to that address (dont need to specify which contact you're viewing as), then follow your same steps to make sure you get a page view. You can't test on behalf of somebody, but you can test your own contact records. Your IP doesn't fall under the ones excluded here: https://app.hubspot.com/settings/1859609/analytics-and-tracking/domains but I usually test on a VPN to make 100% sure that I am an anonymous visitor or that my cookie isn't somehow associated with another contact in my hubspot account.


#34

Hi @Connor_Barley -- clearly the send test email feature didn't work as I expected! So I created a test contact and sent an email to its inbox, as you suggested and registered page hits as expected now.

However, I could not replicate that behavior in test mode, from my dev machine, using localhost as the domain. Would you expect that to work? If I use the identify function, localhost works just fine to register page hits.

Many thanks!


#35

Hey @mflorence99 :wave:,

I would expect any domain that has your tracking code on it to work, as long as it is listed here: https://app.hubspot.com/settings/1859609/analytics-and-tracking/domains