MCPcopy Create free account
hub / github.com/ampproject/amphtml / constructSessionInfo

Function constructSessionInfo

extensions/amp-analytics/0.1/session-manager.js:330–339  ·  view source on GitHub ↗

* Constructs a new SessionInfoDef object * @param {boolean} engaged * @param {number=} count * @return {!SessionInfoDef}

(engaged, count = 1)

Source from the content-addressed store, hash-verified

328 * @return {!SessionInfoDef}
329 */
330function constructSessionInfo(engaged, count = 1) {
331 return {
332 [SESSION_VALUES.SESSION_ID]: generateSessionId(),
333 [SESSION_VALUES.CREATION_TIMESTAMP]: Date.now(),
334 [SESSION_VALUES.ACCESS_TIMESTAMP]: Date.now(),
335 [SESSION_VALUES.COUNT]: count,
336 [SESSION_VALUES.EVENT_TIMESTAMP]: undefined,
337 [SESSION_VALUES.ENGAGED]: engaged,
338 };
339}
340
341/**
342 * @param {!Element|!ShadowRoot|!../../../src/service/ampdoc-impl.AmpDoc} elementOrAmpDoc

Callers 3

getOrCreateSession_Method · 0.85
updateSession_Method · 0.85

Calls 2

generateSessionIdFunction · 0.85
nowMethod · 0.80

Tested by

no test coverage detected