Log Search Widget Input

522
6
01-08-2019 05:51 AM
GaryBarden
New Contributor III

I'm looking to find out if there is a way to log the information that a named user is searching for via the search widget in a web mapping app?

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

Gary,

   Not using the AGOL apps where you have to ability to change the code base.

0 Kudos
GaryBarden
New Contributor III

Robert,

What about in a custom app in portal?

Gary

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Gary,

   If it is a custom app then you can add code and you can log the users searches.

0 Kudos
GaryBarden
New Contributor III

That's great....If you have a minute I have a couple follow up questions. 

1.) If a named user were executing the search, would the code be able to include, named user in the log?

2.) Would you have an example of the code in question?

Thank you again Robert! 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Gary,

  I don't have an example (never needed this myself). But to get the user you would need to add code using IdentityManager class and getCredential method

https://developers.arcgis.com/javascript/3/jsapi/identitymanager-amd.html#getcredential 

To get the search term used you would need to get the Search dijits value property and log that

https://developers.arcgis.com/javascript/3/jsapi/search-amd.html#value 

0 Kudos
GaryBarden
New Contributor III

Thank you Robert. I truly appreciate your input. 

0 Kudos