Regenerate User ID

In Configuration API Call
{ "regenerateUser": true } PLUMBR.regenerateUser()

Plumbr browser agent uses a randomly generated tracking ID for each user, which can then assigned an identity by setting it via config or api. However we’ll only use the first known identity for the user. If you wish to change the user identity later (for example updating info based on “user + role”, and user changing role), a new user tracking ID must be generated.

Regenerating via configuration

Ideal for: When it’s needed after role change that causes hard navigation (eg. form submit, clicking on link). The transaction containing page load will be linked to the new user.

Example:

<script
  src="https://browser.plumbr.io/pa.js"
  crossorigin="anonymous"
  data-plumbr='{
    ...
    "regenerateUser": true,
    "userId": "Admin as John Doe"
  }'>
</script>

Regenerating via API

Ideal for: When it’s needed after ajax requests. The transaction that is made after calling the method will be linked to the new user.

Example:

// In callback of some ajax method
function (newUserIdentity) {
  try {
    // Generate new user tracking ID
    PLUMBR.regenerateUser()
    // Set new user identity
    PLUMBR.setUserId(newUserIdentity)
    // Start new transaction that is linked to this user
    PLUMBR.startTransaction()
  } catch(err) {}
}