Skip to main content
The page event lets you record whenever a user visits a page, along with any optional properties about the page. Each time Edgee collects a page event, it sends the data to the analytics components you’ve previously set up in your Edgee project.

Event fields

The page event collects several fields about the page (all optional):
FieldTypeDescription
nameStringThe name of the page
categoryStringThe category of the page
titleStringThe title of the page
urlStringThe full url of the page, with scheme, host, path, and search
pathStringThe path of the page
searchStringThe search query of the page
referrerStringThe referrer of the page (full URL)
keywordsArrayThe keywords associated with the page
propertiesObjectFree-form dictionary of properties of the page

How to collect the page event?

1 - Automatically

If you followed the Data Collection Highlights, you’ve already installed the Edgee SDK on your website. Once you’ve installed it, Edgee collects the page event for each page viewed, setting the values of the above fields from the HTTP request or DOM.

2 - Manually

In some cases, manually triggering the page event is necessary to accurately collect user movements across different views. Edgee’s SDK facilitates this through the edgee.page() method, allowing developers to send page events with custom data whenever a user navigates to a new part of the application. Here’s an example of how to manually trigger a page event:
window.addEventListener('edgee:loaded', function(){
    edgee.page();
});
If you call the edgee.page() method without any parameters, Edgee will use the fields gathering strategy described below. But to keep the data collection under your control, you can specify the fields directly in the method. Here is an example of a complete edgee.page() call:
// Syntax: edgee.page(page_obj, components);
edgee.page({
    "name": "page-name",
    "category": "my-category",
    "title": "Hello world!",
    "url": "https://www.example.com/welcome.html",
    "path": "/welcome.html",
    "search": "?utm_source=google",
    "keywords": ["hello", "world"],
    "properties": {
        "section": "political"
    }
}, {
    "edgee/google-analytics": true,
    "edgee/amplitude": false
});
The edgee.page() method expect two optionals parameters:
FieldTypeDescription
page_obj (optional)Object|StringA dictionary object containing details of the page event. This object can include all the following optional fields: name, category, title, url, path, search, keywords, and properties. You can also provide a string that will be used as the name field.
components (optional)ObjectSpecifies which analytics components should receive the event data. This allows for targeted data sending based on your configured components within the Edgee platform.

Fields gathering

In case you don’t specify the fields in the edgee.page() function, here’s how Edgee gathers the page information:
FieldTypeHow the value is determined
nameStringSet by the edgee.page() function (if provided), otherwise taken from the page’s <title> tag.
categoryStringOnly set if provided in the page_obj parameter of the edgee.page() function.
titleStringSet from the page_obj parameter if provided, otherwise taken from the page’s <title> tag.
urlStringSet by the edgee.page() function (if provided), or else from the <link rel="canonical"> tag, or finally from the HTTP request.
pathStringSet from the page_obj parameter if provided, otherwise taken from the HTTP request.
searchStringSet from the page_obj parameter if provided, otherwise from the HTTP request.
keywordsArraySet from the page_obj parameter if provided, otherwise from the <meta name="keywords"> tag.
propertiesObjectOnly defined if provided in the page_obj parameter—used as a free-form dictionary of page properties.

Control the components that will receive the events

If for some reason you don’t want to send the page event to all the components you’ve set up in your Edgee project, you can specify the components that will receive the event data in the components parameter of the edgee.page() function.
// Syntax: edgee.page(page_obj, components);
edgee.page({
    "name": "page-name",
    "category": "my-category",
    "title": "Hello world!",
    "url": "https://www.example.com/welcome.html",
    "path": "/welcome.html",
    "search": "?utm_source=google",
    "keywords": ["hello", "world"],
    "properties": {
        "section": "political"
    }
}, {
    "edgee/google-analytics": true,
    "edgee/amplitude": false
});
If the components parameter is not specified, Edgee will send the event to all the components you’ve set up in your Edgee project.

Privacy by design

At Edgee, we prioritize user privacy and the protection of personal data. Our approach to handling page event data is designed to respect user privacy by default, ensuring data is anonymized and processed in compliance with stringent data protection standards.

Anonymization by default

When processing page event data for analytics component, Edgee implements robust data anonymization techniques. These methods are designed to remove or alter personally identifiable information (PII), rendering it impossible to trace the data back to any individual. Through this process, data is stripped of identifying details, ensuring it cannot be used to track or identify users.

The Option for PII Transmission

While our standard practice involves anonymizing all page event data, we recognize that certain analytics use cases may require the transmission of PII. Edgee supports this capability, allowing developers to include PII in page events if necessary. However, it’s crucial to understand the implications:
  • User Consent is Paramount: Before sending any PII through Edgee, you must obtain explicit consent from the users whose data is being collected. This consent should be informed, meaning users are fully aware of what data is collected and how it will be used.
  • Responsibility of the Developer: If you choose to send PII with page events, the responsibility for managing that data in compliance with applicable privacy laws rests with you, the Edgee customer. You must ensure that your data collection practices adhere to GDPR, CCPA, or any other relevant data protection regulations.
With anonymization, we guarantee that default page data sent to your analytics components cannot be used to identify and track an individual. Therefore, you don’t need to ask for consent before sending default page event data to Edgee, as no personal data is sent. To know more about how we handle privacy, check the dedicated Privacy documentation.

Best Practices for page Events

  • Rich Context: The Data Layer allows for the specification of comprehensive context data for each event, enhancing the granularity of analytics data captured. Don’t hesitate to provide as much information as possible about the page.
  • Manual JS Compatibility: Edgee’s manual triggering capabilities ensure that you can collect pageviews without the traditional webpage reloads.
  • Flexible Destination Configuration: Utilize the components parameter to fine-tune where your data is sent, optimizing for relevance and efficiency.