Adobe Analytics

Adobe AppMeasurement.js


What is the use of math.random() in Adobe AppMeasurement.js?


Math.random() is used for three purposes including:

  1. Sampling: Depending on the implementation, some information could be gathered for only a small percentage of the visitors.  Math.random() is used to determine, if a visitor should send the hit information or not.
  2. Fallback Visitor ID: If the visitor id cannot be retrieved from cookies, a random visitor id is generated. It could happen, if the user has cookies disabled (it uses two calls to math.random())
  3. Cache Busting: A random number is added to the end of requests to prevent browser caching.