3

I Created one Experiment by Following SDL Documentation. I can see all Component Presentations on my DD4T Web Application Page but when i click on my Experiment in CME to see the statistics it throws the Error says :

   com.tridion.smarttarget.SmartTargetException: java.util.concurrent.ExecutionException: com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
  {
    "error" : "invalid_grant"
 }
at com.tridion.smarttarget.analytics.AnalyticsManager.getStatistics(AnalyticsManager.java:210) ~[smarttarget_core.jar:na]
at com.tridion.smarttarget.analytics.AnalyticsManager.getStatistics(AnalyticsManager.java:184) ~[smarttarget_core.jar:na]
at com.tridion.smarttarget.experiments.Experiment.loadStatistics(Experiment.java:198) ~[smarttarget_core.jar:na]
at com.tridion.smarttarget.webservices.experiments.ExperimentResolver.getExperimentsWithStatistics(ExperimentResolver.java:148) ~[smarttarget_api_webservice.jar:na]
at com.tridion.smarttarget.webservices.experiments.ExperimentResolver.resolveCollection(ExperimentResolver.java:57) ~[smarttarget_api_webservice.jar:na]
at com.tridion.webservices.odata.input.resolver.ResolverBase.resolve(ResolverBase.java:74) [cd_odata.jar:na]
at com.tridion.webservices.odata.input.handler.ODataFeedRenderer.renderODataFeed(ODataFeedRenderer.java:45) [cd_odata.jar:na]
at com.tridion.webservices.odata.input.handler.ODataWebserviceHandler.handleODataEntity(ODataWebserviceHandler.java:141) [cd_odata.jar:na]
at com.tridion.webservices.odata.input.handler.ODataWebserviceHandler.handleResourceRequest(ODataWebserviceHandler.java:117) [cd_odata.jar:na]

It seems Google Analytics API is not Authorizing the token (P12 key in our case), do i need to do anything different for OATH Authentication.

Note : I have Set Up Analytics mentioned in SDL Docs,and i can see Statistics for my DD4T Application Pages on https://analytics.google.com/analytics/

This is what i used in my Smart Target Config File :

  <Analytics implementationClass="com.tridion.smarttarget.analytics.google.GoogleAnalyticsManager" timeoutMilliseconds="5000" trackingRedirectUrl="/redirect/">
        <ServiceAccountEmailAddress>[email protected]</ServiceAccountEmailAddress>
        <PrivatekeyPath>C:\NeelNew\Tieto Project-d6daec6b60f9.p12</PrivatekeyPath>
        <AccountId>74328616</AccountId>
        <TrackingId>UA-74328616-1</TrackingId>
        <ViewId>117415479</ViewId>
        <CustomDimensions>
            <ExperimentId>1</ExperimentId>
            <PublicationTargetId>2</PublicationTargetId>
            <PublicationId>3</PublicationId>
            <PageId>4</PageId>
            <Region>5</Region>
            <ComponentId>6</ComponentId>
            <ComponentTemplateId>7</ComponentTemplateId>
            <ChosenVariant>8</ChosenVariant>
        </CustomDimensions>
    </Analytics>

I wonder if Service Account Email Address is my Google Account through which i logged in to Google, is it true? Also please suggest me what i am missing. Do i neeed to do anything extra apart from the Documentation on SDL.

1 Answer 1

7

The Service Account Email, doesn't need to be the one you use to log on google analytics pages.

The Service Account Email is the one you use to generate de .p12 file.

Then in Google Analytics Admin of the site you want to use, this Account Service Email, must be granted in the "User Management" tab. With at least "Read and Analyze" permission.

Like in the image:

enter image description here

4
  • Although i am getting new error now which says com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request { "code" : 400, "errors" : [ { "domain" : "global", "message" : "Invalid value 'ga:1==6ac8d87e-0498-4b5d-bf47-4591016a866b;ga:2==tcm:0-4-65537' for filters parameter.", "reason" : "invalidParameter" } ], Do i need to add any tracking code for components tracing, i am confused how it tracks components added in experiment Feb 26, 2016 at 11:15
  • Where ga:1 is PromotionId andga:2 is PublicationtargetId which i can see while debugging the experiments. Feb 26, 2016 at 11:31
  • I recommend you to post another question with the error in detail, as it seems different from the original cause. Feb 26, 2016 at 11:49
  • I have Created a new question. tridion.stackexchange.com/questions/14041/…. Thanks Feb 26, 2016 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.