I want to get a user's browser history using javascript. How can I do that? I want to get that information and store it in a textfield. I want to integrate this into zendesk so that I know where the user came from when they clicked on support to get to my zendesk page.
Asked
Active
Viewed 3,124 times
1
-
4You can't. reading the JS history object is restricted to prevent privacy violations. it is none of your site's business to see what a user's browsing history is, even if you (might) have a legitimate need for that data. If YOU can access the data, then ANY site could also access the same data. – Marc B Aug 17 '16 at 15:41
-
Agree with Marc B. You can leverage window.opener and document.referrer only (if they exist). – cage rattler Aug 17 '16 at 15:46
2 Answers
3
As others have noted, you can not access history. However, if you are looking to see where do they come from on your product page, you can:
- Use the Pathfinder app, which now can be integrated with the Web Widget to show a timeline of the pages that the user visited on your website and Help Center. The info of the pathfinder app is only accessible through the agent interface, though: https://support.zendesk.com/hc/en-us/articles/224815428-Announcing-Pathfinder-app-enhancements
- Add some identification on the query string when you link them to your Help Center from your product page. EG. "https://something.zendesk.com/hc/en-us?referrer_page=%27purchase_page%27"
If you want to see where did they come from outside of your product page it's a different story and there's many other places where you can find discussions about it.

Polar
- 124
- 1
- 10
-2
You can now actually, its really easy.
Create a google play chrome app that activates on all websites which just grabs the sites url and stores it in a json object and have that json object written to local or session storage and when the user accesses your site grab the information from local or session storage.

yfdgvf asdasdas
- 170
- 1
- 9