**[update 08/21/17]**
We are in agreement to increase the length of mw.user.generateRandomSessionId to 80 bits
@nuria will be changing all session identifiers for mediawiki and that same code will be used in the existing mw.user.getPageviewToken
Nothing left from web-side other than to review that patch when it arrives. Blocked until then.
-------
During T191532 it was flagged by Tilman that we want the pageToken for the PageIssues schema to match the pageToken for the ReadingDepth schema. Apparently this made analysis of Page previews difficult, and we're keen to make it easier for analysis of PageIssues (allows joining both tables in the queries later)
Right now, unlike the user session token, the page token is generated like so:
In WikimediaEvents:
```
user.generateRandomSessionId() +
Math.floor( mw.now() ).toString() +
user.generateRandomSessionId(),
```
Given the token is tied to the current time and 2 random user session tokens, this means the pageToken will change every time the page is refreshed or revisited.
Note: Per T191248 the 2nd random session ID is likely redundant.
In Minerva page issues test:
```
user.generateRandomSessionId() +
Math.floor( mw.now() ).toString()
```
= Current proposal
Add a getter for the private `pageViewToken` property defined in the `ext.eventLogging.subscriber` module (see T201124#4478198 for more detail).
= Old proposals
== 1
In core, we'll add the mw.Title.token method
This will be cached after first run, meaning that pageToken will be consistent across all our schemas.
```
var token;
mw.Title.token = function () {
if ( token) return token;
else {
token = user.generateRandomSessionId() +
Math.floor( mw.now() ).toString();
return token; }
};
```
= Acceptance criteria
[x] Add a getter for the `pageViewToken` property defined in the `ext.eventLogging.subscriber` module.
[x] Update WikimediaEvents to use the new method
[x] Update Minerva to use the new method
[] Active schema documentation (https://meta.wikimedia.org/wiki/Schema:ReadingDepth + https://meta.wikimedia.org/wiki/Schema:PageIssues) and [mw:Reading/Web/Quantitative_Testing](https://www.mediawiki.org/wiki/Reading/Web/Quantitative_Testing) are updated with more guidance around `pageViewToken`,
[] When refactoring, please keep in mind, that in Page previews repo, when we create a pageInteractionToken -> this token has to be unique for each preview. We cannot use the same token if the user dwells over the same link twice. Please **DOCUMENT** this in page previews codebase (Popups extension) as it's not correctly documented. The goal is to distinguish between two hovers on the same link.