AEM 6.2 - Implementing Server-Side Page Naming for Analytics | Community
Skip to main content
Premkarthic-7WP
Level 4
Aug 9, 2017 11:16 AM UTC
Solved

AEM 6.2 - Implementing Server-Side Page Naming for Analytics

Hi,

We are trying to integrate aem and adobe analytics to show the PageViews and Unique Views details on Sites page analytics and Content Insight.

As we have custom pattern for pageName we tried to implement the server side page names as per the documentation - Implementing Server-Side Page Naming for Analytics .

The issue is getPageName(AnalyticsPageNameContext context) method from custom AnalytciPageNameProvider class is not getting invoked, so because of that we are always seeing incorrect data get stored on the pages.

Note: getResource(AnalyticsPageNameContext context) from custom class is getting invoked. We debugged the AEM 6.2 default analytics bundle and we didn't able to see any occurrence of calling getPageName from custom or default AnalytciPageNameProvider class.

Is this a bug in aem 6.2 or are we missing anything while doing the integration?

Any pointer to fix this will help us more.

Thanks in advance.

-Prem

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Feike_Visser1
Feike_Visser1Accepted solution
Employee
Aug 10, 2017 10:23 AM UTC

here an example:

@Override
public Resource getResource(AnalyticsPageNameContext context) {
String pageName = context.getPageName();
log.info("Entering getResource for pageName {}", pageName);
ResourceResolver rr = context.getResourceResolver();
if ( ! pageName.startsWith("content")) {
pageName = "content:" + pageName;
}
pageName = "/" + StringUtils.replace(pageName, ":", "/");
log.info("Search for page {}", pageName);
Resource resource = rr.resolve(pageName);
if ( resource.adaptTo(Page.class) != null) {
log.info("Page found");
return resource;
} else {
log.info("Page not found");
}
return null;
}

4 replies

Feike_Visser1
Feike_Visser1Accepted solution
Employee
Aug 10, 2017 10:23 AM UTC

here an example:

@Override
public Resource getResource(AnalyticsPageNameContext context) {
String pageName = context.getPageName();
log.info("Entering getResource for pageName {}", pageName);
ResourceResolver rr = context.getResourceResolver();
if ( ! pageName.startsWith("content")) {
pageName = "content:" + pageName;
}
pageName = "/" + StringUtils.replace(pageName, ":", "/");
log.info("Search for page {}", pageName);
Resource resource = rr.resolve(pageName);
if ( resource.adaptTo(Page.class) != null) {
log.info("Page found");
return resource;
} else {
log.info("Page not found");
}
return null;
}
Translate
Feike_Visser1
Employee
Aug 10, 2017 10:20 AM UTC

The getResource() is called when data is imported from analytics.

getPageName() is called when the direct integration is used.

So this is how it is meant to be.

Translate
Premkarthic-7WP
Level 4
Aug 10, 2017 8:48 AM UTC

Thanks kautuk for your response!

Please confirm us back, once you got reply from internal team!.

-Prem

Translate
kautuk_sahni
Employee
Aug 10, 2017 8:45 AM UTC

I have asked internally to see if this is known issue.

~kautuk

Translate
Kautuk Sahni