Reporting Search Term in URL string | Community
Skip to main content
New Participant
September 26, 2016
Solved

Reporting Search Term in URL string

  • September 26, 2016
  • 2 replies
  • 1304 views

I need to report search terms that are part of the URL string. The URL "http://about.jstor.org/search/node/jstor" contains the search term, "jstor",  at the end of the URL.

When test "window.location.href.substring(35);" in the developer console, it returns the search term value. When I add s.eVar61 to the string "s.eVar61 = window.location.href.substring(35);" and test it in the console, I get and Uncaught Reference Error. How do I fix it so that I can I parse out and report the search term in the URL string?

 

Thank you,

Bill

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Gigazelle

if the protocol is absent or different, or if the URL is any longer or shorter, that's going to give you some issues there.

You could try instead using the following:

s.eVar61=window.location.href.split('/search/node/')[1];

2 replies

Bsmith320Author
New Participant
October 5, 2016

I will give it a try.

Thank you

Gigazelle
GigazelleAccepted solution
Employee
October 3, 2016

if the protocol is absent or different, or if the URL is any longer or shorter, that's going to give you some issues there.

You could try instead using the following:

s.eVar61=window.location.href.split('/search/node/')[1];