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.

For React applications, once you have successfully installed the React-Edgee SDK, no further action is required. This library ensures seamless integration of Edgee’s services and accurate tracking of page views during SPA navigations.

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();
});

Edgee Data Layer

You can manually specify each field by writing what we call a Data Layer in your page.

Here is an example of how to insert a Data Layer:

In this example, we’ve specified the name, category, title, and url fields for the page event. Edgee will use this information to enrich the data collected for each page view, providing a more detailed view of user interactions on your website.

To know more about the Data Layer capabilities, check the dedicated documentation.

Fields gathering

In case you don’t specify a Data Layer, here’s how Edgee gathers the page information:

FieldTypeField definition order
nameStringdata layer, or by the page’s title tag
categoryStringThis field is only defined by the data layer
titleStringdata layer, or by the page’s title tag
urlStringdata layer, or the canonical tag, or the http request
pathStringdata layer, or the http request
searchStringdata layer, or the http request
keywordsArraydata layer, or the keywords meta tag
propertiesObjectFree-form dictionary of properties, only defined by the data layer

Feel free to choose the best way to specify the page event fields, but remember that the Data Layer is the most powerful way to do it.

Control the destinations of 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 Data Layer.

If the components parameter is not specified, Edgee will look at data_collection.components in the Data Layer. If not defined, the event will be sent to all your components.

More about manual triggering

Edgee automatically collects page event when a page is called, but in some cases, you may need to manually trigger the page event.

If you call the edgee.page() method without any parameters, Edgee will use the fields gathering we’ve seen before. But to avoid having to change the Data Layer every time you manually call edgee.page(), you can specify the fields directly in the method, which will have the effect of overloading field gathering.

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"
    }
}, {
    "google_analytics": true,
    "amplitude": false
});

The edgee.page() method expect two optionals parameters:

FieldTypeDescription
page_objoptionalObject|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.
componentsoptionalObjectSpecifies which analytics components should receive the event data. This allows for targeted data sending based on your configured components within the Edgee platform.

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.