Browsing Activity History

Hi, I am trying to find out if it is possible to receive a feed of all browsing activity (ie the history you can see for a contact) into an external database such as FastStats Apteco). As far a we can see you are able to export last page visited but not the history of all pages visited. I tried Hubspot help and they suggested I try this forum. Thank you for your help, Claire

Hi @Claire3,

Yes, this is possible using the Web Analytics API. This allows you to extract various events from the CRM like page views, email opens and more.

If you want to extract page view data/browsing history you can use the “eventType=e_visited_page” query parameter in your request. See an example of a request below where I extract page view data for a contact with ID “475951”:

GET https://api.hubapi.com/events/v3/events?objectType=contact&objectId=475951&eventType=e_visited_page
RESPONSE
{
 "results": [
 {
 "objectType": "CONTACT",
 "objectId": "475951",
 "eventType": "e_visited_page",
 "occurredAt": "2021-09-08T13:32:18.964Z",
 "id": "leviathan-91fa1470-cd4a-369a-8c11-9599b1f98758",
 "properties": {
 "hs_base_url": "www.jackhubspot.com/",
 "hs_browser": "Chrome",
 "hs_city": "dublin",
 "hs_content_id": "50581023389",
 "hs_content_type": "STANDARD_PAGE",
 "hs_country": "ie",
 "hs_device_name": "Galaxy Tab A7 10.4",
 "hs_device_type": "Tablet",
 "hs_language": "en",
 "hs_operating_system": "Android",
 "hs_page_title": "Jack HubSpot | Home",
 "hs_query_params": "",
 "hs_region": "d",
 "hs_title": "Jack HubSpot | Home",
 "hs_url": "http://www.jackhubspot.com/",
 "hs_url_domain": "jackhubspot.com",
 "hs_url_path": "/",
 "hs_user_agent": "Mozilla/5.0 (Linux; Android 11; SM-T500) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.166 Safari/537.36",
 "hs_utm_content": "157205914",
 "hs_utm_medium": "email",
 "hs_utm_source": "hs_email"
 }
 },
 {
 "objectType": "CONTACT",
 "objectId": "475951",
 "eventType": "e_visited_page",
 "occurredAt": "2021-09-08T13:33:01.449Z",
 "id": "leviathan-878dcc87-48cf-35ef-a8e5-6b2432598a82",
 "properties": {
 "hs_base_url": "www.jackhubspot.com/faq",
 "hs_browser": "Chrome",
 "hs_city": "dublin",
 "hs_content_id": "50726855984",
 "hs_content_type": "STANDARD_PAGE",
 "hs_country": "ie",
 "hs_device_name": "Galaxy Tab A7 10.4",
 "hs_device_type": "Tablet",
 "hs_language": "en",
 "hs_operating_system": "Android",
 "hs_page_title": "Jack HubSpot | FAQ",
 "hs_referrer": "http://www.jackhubspot.com/",
 "hs_region": "d",
 "hs_title": "Jack HubSpot | FAQ",
 "hs_url": "http://www.jackhubspot.com/faq",
 "hs_url_domain": "jackhubspot.com",
 "hs_url_path": "/faq",
 "hs_user_agent": "Mozilla/5.0 (Linux; Android 11; SM-T500) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.166 Safari/537.36"
 }
 }
 ]
}

As you can see a lot of information is returned relating to the page view. Perhaps the most important in your instance is the “hs_base_url” which is the URL of the page the contact viewed.

I hope this helps and good luck with the project! :blush:

Thank you for your help! Much appreciated :blush: