NavigationHistory.Tracker (navigation_history v0.4.1)
View SourceA plug to track user navigation history.
Visited paths will be stored in the session by the plug.
The paths can then be accessed with NavigationHistory.last_path
and
NavigationHistory.last_paths
.
The session must already be fetched with Plug.Conn.fetch_session/1
.
Options
:excluded_paths
- The list of paths which should not be tracked. For example,/login
or similar for a lot of apps. Defaults to[]
:included_paths
- Limits list the paths to be tracked when set.:excluded_paths
is ignored if set.:methods
- The list methods which should be tracked. Defaults to["GET"]
:history_size
- The number of history entries to track inlast_paths
. Defaults to10
.:key
- The key used to track the navigation. It can also be passed to:last_path
and:last_paths
to retrieve the paths for the relevant key. Defaults to"default"
.:accept_duplicates
- By default, if the same URL is repeated, it is ignored, unless this option is set totrue
. Defaults tofalse
.
Examples
plug NavigationHistory.Tracker, excluded_paths: ["/login", ~r(/admin.*)], history_size: 5