setSessionHash

The setSessionHash() method controls the sh parameter sent with tracking events. This setting is persisted across app launches. The default value is DISABLED.

Syntax

getTracker().setSessionHash(sessionHash);
tracker.setSessionHash(sessionHash)

Parameters

sessionHash (SessionHash, required)

The session hash mode. Available values:

  • SessionHash.ENABLED - the sh parameter is set to 1
  • SessionHash.DISABLED - the sh parameter is set to 0 (default)
  • SessionHash.NOT_SET - the sh parameter is not sent. The processing service uses the value from the Privacy tab in global or app settings.

Examples

To enable the session hash:

Tracker tracker = ((PiwikApplication) getApplication()).getTracker();
tracker.setSessionHash(SessionHash.ENABLED);
val tracker: Tracker = (application as PiwikApplication).tracker
tracker.setSessionHash(SessionHash.ENABLED)

Related methods