navigation_history v0.2.0 NavigationHistory.Tracker

A 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 in last_paths. Defaults to 10.
  • 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".

Examples

  plug NavigationHistory.Tracker, excluded_paths: ["/login", ~r(/admin.*)], history_size: 5

Summary

Functions

Callback implementation for c:Plug.call/2

Callback implementation for c:Plug.init/1

Functions

call(conn, opts)

Callback implementation for c:Plug.call/2.

init(opts)

Callback implementation for c:Plug.init/1.