Hi all,
we are implementing the pageView tracking to analytics and wanted to use one of the event reported here: https://experienceleague.adobe.com/docs/experience-manager-learn/sites/integrations/analytics/collec...
we have cmp:show and cmp:loaded, is there an event that is better to choose? can it be that one of the event here triggers more than once impacting pageView count?
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Nick_2024
When implementing page view tracking to Adobe Analytics in AEM, both `cmp:show` and `cmp:loaded` events can be used. However, it's important to understand the differences between these events and how they can impact the page view count.
1. `cmp:show` event: This event is triggered when a component becomes visible on the page. It is typically used when you want to track the visibility of specific components. For example, you might want to track when a carousel or a banner becomes visible to the user. The `cmp:show` event can be triggered multiple times if the component visibility changes, such as when the user scrolls or interacts with the page.
2. `cmp:loaded` event: This event is triggered when a component is loaded on the page. It is typically used when you want to track the initial loading of components. For example, you might want to track when a specific component is loaded for the first time. The `cmp:loaded` event is typically triggered only once per component, as it represents the initial loading of the component.
In terms of choosing the event for page view tracking, it depends on your specific use case and what you want to track. If you want to track the visibility of components and how they are displayed to the user, you can use the `cmp:show` event. If you want to track the initial loading of components, you can use the `cmp:loaded` event.
Hi @Nick_2024
When implementing page view tracking to Adobe Analytics in AEM, both `cmp:show` and `cmp:loaded` events can be used. However, it's important to understand the differences between these events and how they can impact the page view count.
1. `cmp:show` event: This event is triggered when a component becomes visible on the page. It is typically used when you want to track the visibility of specific components. For example, you might want to track when a carousel or a banner becomes visible to the user. The `cmp:show` event can be triggered multiple times if the component visibility changes, such as when the user scrolls or interacts with the page.
2. `cmp:loaded` event: This event is triggered when a component is loaded on the page. It is typically used when you want to track the initial loading of components. For example, you might want to track when a specific component is loaded for the first time. The `cmp:loaded` event is typically triggered only once per component, as it represents the initial loading of the component.
In terms of choosing the event for page view tracking, it depends on your specific use case and what you want to track. If you want to track the visibility of components and how they are displayed to the user, you can use the `cmp:show` event. If you want to track the initial loading of components, you can use the `cmp:loaded` event.
@Nick_2024 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes
Hi @Nick_2024
When implementing page view tracking for analytics with Adobe Experience Manager (AEM), it is important to select the appropriate event to ensure accurate page view counts. The documentation provided from the AEM Core Components library describes several events, including cmp:show and cmp:loaded, which can be used to trigger analytics tracking.
The cmp:show event is triggered on page load and is dispatched from in-line JavaScript immediately beneath the opening <body> tag, making it the earliest event in the Data Layer event queue. This event is particularly used in components like the accordion, carousel, and tabs when a user views or interacts with these components.
The cmp:loaded event is triggered as soon as the Data Layer is populated with the Core Components on the page. This event signals that all the initial components have been loaded onto the page.
In choosing between cmp:show and cmp:loaded for page view tracking, consider the following:
It is important to note that if any of the components that trigger the cmp:show event are dynamic and can load content after the initial page load (e.g., lazy loading of tabs or additional content being loaded into an accordion), it could potentially trigger the event multiple times. This could indeed impact the page view count if not handled properly.
For precise page view tracking, you might want to:
It's also recommended to configure your analytics to differentiate between the initial page load event and subsequent interactions that may trigger the same events. Doing so will provide a more accurate representation of user engagement with the page.
For more information on the events triggered by AEM Core Components, you may refer to the official documentation:
Views
Likes
Replies
Views
Likes
Replies