AEM 6.2 - Implementing Server-Side Page Naming for Analytics | Community
Skip to main content
Premkarthic-7WP
New Participant
August 9, 2017
Solved

AEM 6.2 - Implementing Server-Side Page Naming for Analytics

  • August 9, 2017
  • 4 replies
  • 1567 views

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.
Best answer by Feike_Visser1

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
August 10, 2017

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;
}
Feike_Visser1
Employee
August 10, 2017

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.

Premkarthic-7WP
New Participant
August 10, 2017

Thanks kautuk for your response!

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

-Prem

kautuk_sahni
Employee
August 10, 2017

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

~kautuk

Kautuk Sahni