-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send events on the server-side #3
base: main
Are you sure you want to change the base?
Conversation
Do you know if this is officially supported by their API? it seems like the IP address isn't forwarded for events, meaning HubSpot might consider the request to be coming from a different place. For forms we have |
The We could add an |
@bjesus The code has been reformatted as requested. |
Thanks @Manouchehri , but I'm afraid we can't merge this. Managed Components that are using an unofficial API are the result of reverse engineering client-side pixels and replicating their behavior. We cannot assume that if we send the same request server-side, without 3rd-party cookies and without the origin IP, it will work just the same (if we've done that, Zaraz would never make client-side requests, and 50% of the tools would have been broken...). We also cannot assume that Hubspot is reading a specific HTTP header. Putting aside that I too wish things worked this way, do you have any reason to think this works? Have you tested this? Are IPs being recorded correctly? |
Looks like it's working to me. I've also gone ahead in in 2b89361 and added the extra documented headers that HubSpot recommends. |
Thanks for checking @Manouchehri ! As for tracking events - can you confirm that your real location isn't cayman islands? I mean, is it clear that HTTP header is spoofing the origin IP of the request? For forms - I've talked with @Refaerds from the team and we're a little confused - what kind of forms are you trying to track? Are these forms built inside Hubspot, or forms on your website that you want Hubspot to track? It seems like the endpoint you want to use is meant for the former, while the original |
I was using the older Zaraz HubSpot tool for this just fine. |
Indeed it looks like we had a naming issue when converting our code to a Managed Component because we named both events the same, but they're doing something different: one is tracking forms created by Hubspot and the other is tracking normal forms on the website. I'm still trying to understand - what kind of form are you trying to track? I suspect things broke when you converted not because the code is wrong, but because it now supports the other type of forms. If that's the case, we shouldn't remove or change the current handler, and instead we should add another that works like the previous implementation. |
Forms created by HubSpot.
It is my real location. Hmm, how about we add a flag or something with a warning that server-side tracking events won't be as accurate? |
So thanks to https://github.com/managed-components/create-managed-component, I've started to run this fork on our website to see what happens in production. Interestingly it seems like the conversion info metadata (which is created from the IP address) is left blank during my last test. (Which is better than wrong info IMO.) Let's keep this open for now and I'll report back in a few weeks to see how it works out long-term. =) |
Both types of forms should be supported with this here Hubspot MC now. Could you let us know if the current version works for you? |
@Manouchehri @bjesus , is server-side pageview tracking feasible as a result? Is it only the metadata, like location, that is missing, or is there anything else? |
Just location is missing. Aside from that, works perfectly. |
Tested locally, works fine. The
user-agent
was required, otherwise events were not coming through.