Giter Site home page Giter Site logo

Comments (10)

Bukashk0zzz avatar Bukashk0zzz commented on May 19, 2024 2

Before, I have done similar. The tag replicated web requests, and they were visible inside HubSpot.
I don't have any additional info or insights. Sorry.

from hubspot-tag.

emilianorios1 avatar emilianorios1 commented on May 19, 2024 1

Hi @Bukashk0zzz, this week at the company I work for we tried to implement your script for page views, after a few days of testing and reading the Hubspot script code we made it work, could I make a fix for you to review? The main issue revolved around not having request headers.

We've also managed to also send a user token as a parameter to recognize contacts.

from hubspot-tag.

emilianorios1 avatar emilianorios1 commented on May 19, 2024 1

@Bukashk0zzz great! happy to help :)

from hubspot-tag.

Bukashk0zzz avatar Bukashk0zzz commented on May 19, 2024

Hi, you are right, and it no longer works. I will remove this method from the tag.

from hubspot-tag.

bsq-panagiotis avatar bsq-panagiotis commented on May 19, 2024

@Bukashk0zzz If you have any tips to share on what would be required to make it work I can prepare a fix for you to review.

I tried to imitate server calls, but none of them made it to Hubspot's reports.

from hubspot-tag.

Bukashk0zzz avatar Bukashk0zzz commented on May 19, 2024

Checked once again and removed PageView tracking from the tag.

from hubspot-tag.

Bukashk0zzz avatar Bukashk0zzz commented on May 19, 2024

Sure. Send PR or code here I will review it.
Thanks for posting the info. @emilianorios1

from hubspot-tag.

emilianorios1 avatar emilianorios1 commented on May 19, 2024
function trackPageViewEvent() {
  let url = 'https://track.hubspot.com/__ptq.gif?k=1&v=1.1&bfp=309846428&ct=' + encodeUriComponent('standard-page');
  if (data.accountId) url = url + '&a=' + encodeUriComponent(data.accountId);
  if (eventData.client_id) url = url + '&vi=' + encodeUriComponent(eventData.client_id);
  if (eventData.client_id) url = url + '&u=' + encodeUriComponent(eventData.client_id);
  if (eventData.ga_session_id) url = url + '&b=' + encodeUriComponent(eventData.ga_session_id);
  if (eventData.page_referrer) url = url + '&r=' + encodeUriComponent(eventData.page_referrer);
  if (eventData.page_title) url = url + '&t=' + encodeUriComponent(eventData.page_title);
  if (eventData.page_location) url = url + '&pu=' + encodeUriComponent(eventData.page_location);
  if (eventData.screen_resolution) url = url + '&sd=' + encodeUriComponent(eventData.screen_resolution);
  if (eventData.page_encoding) url = url + '&cs=' + encodeUriComponent(eventData.page_encoding);

  logRequest('page_view', 'GET', url, '');

  sendHttpRequest(url, (statusCode, headers, body) => {
    logResponse(statusCode, headers, body, 'page_view');

    if (statusCode >= 200 && statusCode < 300) {
      data.gtmOnSuccess();
    } else {
      data.gtmOnFailure();
    }
  }, {headers: {'User-Agent': eventData.user_agent}, method: 'GET', timeout: 3500});
}

Our hypothesis is that the requests made by your old code were not processed by HubSpot because it did not send request headers, we tried with the same headers you use for the custom behavioral events and couldn't make it work.

We then had success sending the user_agent in the headers to imitate a request made from a website and after checking the code that HubSpot script loads we concluded that the fields &vi, &u and &b were used to recognize the user token and the session.

What I'm not really sure is if this works in every implementation, since we use Snowplow as our Client I think the client_id and ga_session_id could change when implementing other Clients.

from hubspot-tag.

Bukashk0zzz avatar Bukashk0zzz commented on May 19, 2024

@emilianorios1 look like all is fine. we added this functionality to the template

from hubspot-tag.

Maison-Elan avatar Maison-Elan commented on May 19, 2024

Hi,

The latest fix did not work for me. Same problem as originally reported: status 200 but no data shows up inside HubSpot. @emilianorios1 Does your fix still work for you? I am using Google Analytics 4 as the Client. I tried adding additional accept headers but that did not work. The latest fix does not include the bfp parameter by the way. I'm not sure what its function is.

from hubspot-tag.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.