# system.perspective.getSessionInfo / page path

**URL:** <https://forum.inductiveautomation.com/t/system-perspective-getsessioninfo-page-path/75152>\
**Category:** General Discussion\
**Tags:** perspective\
**Created:** [June 16, 2023, 4:10pm UTC](https://forum.inductiveautomation.com/t/system-perspective-getsessioninfo-page-path/75152 "2023-06-16T16:10:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bwirth](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@bwirth](https://forum.inductiveautomation.com/u/bwirth)\
**Post date:** [June 16, 2023, 4:10pm UTC](https://forum.inductiveautomation.com/t/system-perspective-getsessioninfo-page-path/75152/1 "2023-06-16T16:10:13Z")

</div>

I use system.perspective.getSessionInfo to create this nifty page to see who's in the system.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/7/d7d58ff91e6bc1057a86c35752cabb609a968b7a.png)

What I's really like to add is to know what page path the users have loaded in the pageids. Essentially the contents of below:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/a/3a722295ed241e9e16964f8491a2fc17fdbed2ab.png)

Any ideas? I have put a suggestion in the suggestion box to add this to getSessionInfo, just thought I'd put this out there to get any other ideas I may be missing...

Thanks!

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [June 19, 2023, 8:20am UTC](https://forum.inductiveautomation.com/t/system-perspective-getsessioninfo-page-path/75152/2 "2023-06-19T08:20:43Z")

</div>

I would guess implementing this would be difficult as a session could be using multiple pages at any one time in different tabs/windows and maybe even different browsers.

I've previosuly wanted to do something similiar so that a user would have their previous pages automatically open when they logged back in, but we struggled to get any information of this sort, and it might not be possible. I wonder if being browser based would limit what kind of data can be returned.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 19, 2023, 3:19pm UTC](https://forum.inductiveautomation.com/t/system-perspective-getsessioninfo-page-path/75152/3 "2023-06-19T15:19:04Z")

</div>

> [@Hayden\_Watson](#):
>
> I wonder if being browser based would limit what kind of data can be returned.

Yes.

You would have to track such things yourself, in the various session/page/view life cycle events, while the session is active. But it will be a bit tricky, as you will likely miss page/view closure events when the user closes tabs (browsers don't necessarily honor JS requests to intervene in those operations).

---

<div class="post-metadata">

**Author:** ![bwirth](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@bwirth](https://forum.inductiveautomation.com/u/bwirth)\
**Post date:** [June 19, 2023, 4:17pm UTC](https://forum.inductiveautomation.com/t/system-perspective-getsessioninfo-page-path/75152/4 "2023-06-19T16:17:17Z")

</div>

I started working that and saving to a tag but then decided I didn't need it that bad. Figured this would be something IA could add as they do know the pages from the server in the session details / Pages, you know, if they wanted to...

Just making sure I wasn't missing something.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/9/f92103da0d75f46466f1484ee116a7a1f41018e4.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/4/147d40527222ebe97cd44356ca65c4347d7da985.png)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 19, 2023, 5:09pm UTC](https://forum.inductiveautomation.com/t/system-perspective-getsessioninfo-page-path/75152/5 "2023-06-19T17:09:18Z")

</div>

The session info payload is deliberately flattened so that it's easier to represent in a '2d' format like a dataset, and so it's not (even more complicated) for new users.

In the meantime, you could get access to the same information the status page gives you with a modification of the code here:

> [@Get Perspective Session Page Info from PageIds](https://forum.inductiveautomation.com/t/get-perspective-session-page-info-from-pageids/74585/9):
>
> Just for completeness/posterity, here is a sample of full code that does what I set out to do, ie browse active sessions for a given project, determine if a given view is open on those sessions, and then grab the session id and a couple of session custom props from those sessions and build it out into a map to write to a JSON tag. 
> 
> > **Session Monitor Browse Code**
> >
> > from com.inductiveautomation.ignition.gateway import IgnitionGateway import json project\_name = sytem.util.getProjectName() target\_view\_pa…

---

<div class="post-metadata">

**Author:** ![bwirth](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@bwirth](https://forum.inductiveautomation.com/u/bwirth)\
**Post date:** [June 19, 2023, 5:24pm UTC](https://forum.inductiveautomation.com/t/system-perspective-getsessioninfo-page-path/75152/6 "2023-06-19T17:24:14Z")

</div>

Thank you, very kindly sir! I'll look into this.

---

<div class="post-metadata">

**Author:** ![bwirth](https://avatars.discourse-cdn.com/v4/letter/b/41988e/32.png) [@bwirth](https://forum.inductiveautomation.com/u/bwirth)\
**Post date:** [June 20, 2023, 3:50pm UTC](https://forum.inductiveautomation.com/t/system-perspective-getsessioninfo-page-path/75152/7 "2023-06-20T15:50:40Z")

</div>

In case folks are interested, I did get this to work. I noticed most of my main pages would load at address 'C$0:0$0:2', a couple base pages at 'C'. This helped me target the path that I wanted to see and not all the embedded views. Thanks again everyone for your help!

```auto
inputPageIds = []	# my fuunction passes in pageids from getSessionInfo() call

from com.inductiveautomation.ignition.gateway import IgnitionGateway

project_name = system.util.getProjectName()
# project_name = 'myProject'

context = IgnitionGateway.get()
mod_mgr = context.getModuleManager()
# need to get "com.inductiveautomation.perspective.common.api.PropertyType" from module manager to
# get the "props" and "custom" enums for fetching the session props and the custom props
prop_type_class = mod_mgr.resolveClass('com.inductiveautomation.perspective.common.api.PropertyType')
# the below uses the gateway context module manager to function essentially as an import statement
persp_ctx_class = mod_mgr.resolveClass('com.inductiveautomation.perspective.gateway.api.PerspectiveContext')
# instantiate the PerspectiveContext using the gateway context
persp_ctx = persp_ctx_class.get(context)
# get the PerspectiveSessionMonitor object running in gateway context
psm = persp_ctx.getSessionMonitor()
# grab <InternalSession> object list for the target project
int_sessions = psm.getClientSessionsForProject(project_name)
#	return int_sessions
active_sessions = {}
#	listResults = []
dictResults = {}

# loop over internal sessions to build a map of active sessions with the target view open
for i, sess in enumerate(int_sessions):
	# loop over the open pages for each session and get the id for each
	for page in sess.getPages():
		# this returns the page id that matches the gateway Status -> Connections -> Perspective Sessions -> Session detail page
		page_id = page.getId()
		if page_id not in inputPageIDs : continue
		views = page.getViews()
		for view in views :
			system.perspective.print(str(view.getId()))
			result = str(view.getId()).split('@') # split at @. left (0) is page path, right (1) is address
			# With the way I have things configured, all my pages appear to be at address C$0:0$0:2,
			#	a few home pages come in at "C". This takes 'C$0:0$0:2' if there, 'C' if not
			if result[1] in ['C', 'C$0:0$0:2'] :	
				pageKey = "_" + page_id 
				if pageKey in dictResults.keys() :
					if dictResults[pageKey]['key'] != 'C' : continue
					
# listResults.append( [page_id, result] )
				# write to dict structure formatted string of page path. (some string parts removed for easier reading.)
				dictResults.update( { "_" + page_id : { "path" : str(result[0]).split("/",1)[1].replace("/Large",""), "key" : str(result[1]) } } )
				if str(result[1]) == 'C$0:0$0:2' : break # no need to keep looking on views if I found a 'C$0:0$0:2'
				
return dictResults

```
