Monday, November 5, 2012

Reading data from site catalyst through CQ5

In this article I am going to explain how to read data from site catalyst and display it on CQ5 components

REST api’s :

The omniture exposes REST api to read/write data from site catalyst data source, REST is a lightweight protocol and alternative to Web Services (SOAP, WSDL, etc.), in this I am not going to explain REST based concepts

CQ5:

To connect to site catalyst data source the cq5 has provided cq-analytics.jar file, this jar file is just wrapper of omniture REST api it provide different methods to read data from omniture, using this we can successfully read data from site catalyst from CQ5 environment


POM of cq-analytics jar :

<dependency>
           <groupId>com.day.cq</groupId>
     <artifactId>cq-analytics</artifactId>
           <version>5.4.4</version>
           <scope>provided</scope>
      </dependency>

Code :

The cq5 is provided “SitecatalystWebservice” to connect to site catalyst and there is one more class “Account” we use this entity class to pass account information to site catalyst web service

Account acc = new Account (true, companyName, userName, secret, server);
 
SitecatalystWebservice active = sling.getService(SitecatalystWebservice.class);

String str = active.getReportSuites(acc);

String reports = active.getSuccessEvents(acc,”reportSuiteId”)

The above code returns all success events which are created for “reportSuiteId

CompanyName :

The name is company name which we use to connect to CQ5 omniture site catalyst

Username :

Omniture site catalyst username

Secret:

The secret key is unique for every user we can find this by navigating   “Omniture Site Catalyst”  -> Admin -> Admin Console -> Company

Server :

This is datacenter url we can find this in omniture admin console

0 comments:

Post a Comment