This document outlines how to access predefined properties within the browser's window
object for analytics purposes. These properties, organized under user
, project
, and livepage
settings, are designed to provide consistent and readily available data for tracking and analysis. The objects are frozen to prevent accidental modification, ensuring data integrity.
Key Objects:
window.GEVME.user
: Contains information about the currently logged-in user.window.GEVME.project
: Details about the current project context.window.GEVME.livepage
: Information specific to the currently viewed page.
Accessing Properties:
These objects are accessed using standard dot notation. For example:
JavaScript
// Accessing the user's ID
const userId = window.GEVME.user.id;
// Accessing the project name
const projectName = window.GEVME.project.name;
// Accessing the current page id
const pageUrl = window.GEVME.livepage.id;
Available Properties:
The following properties are available within each object (subject to change; refer to the latest documentation for a complete and up-to-date list):
window.GEVME.user
:
id
: (String/Number) Unique identifier for the user.fullname
: (String) User's display name.[other relevant user properties]
window.GEVME.project
:
id
: (String/Number) Unique identifier for the project.name
: (String) Project name.[other relevant project properties]
window.GEVME.livepage
:
id
: (String) Current page URL.title
: (String) Current page title.[other relevant page properties]
Important Considerations:
- Data Integrity: These objects are frozen to prevent accidental modification. Altering values is not allowed
- Property Availability: The specific properties available within each object might change over time. Consult the latest documentation for the most up-to-date list.
JavaScript
if (window.GEVME.user && window.GEVME.user.id) {
const userId = window.GEVME.user.id;
// Use userId
} else {
// Handle the case where user information is not available
}