Exception while running apex code

133 views
Skip to first unread message

vinoth

unread,
Apr 23, 2013, 8:56:12 AM4/23/13
to forcecom-toolkit-f...@googlegroups.com
Hi,

I have just executed the below code in developer console,
ImportGoogleAnalytics.importDailyMetrics('MySiteName');

I received the following error,
GoogleAnalytics.GoogleAnalyticsException: Request Error: <?xml version="1.0" encoding="UTF-8"?>

Please help me to find a solution.

Regards,
Vinoth

Chuck T

unread,
May 28, 2013, 3:59:48 PM5/28/13
to forcecom-toolkit-f...@googlegroups.com
I'm having the same problem.

Bob Nash

unread,
Aug 1, 2013, 4:47:33 AM8/1/13
to forcecom-toolkit-f...@googlegroups.com
Hi ,
 
I am getting the same issue.
 
Regards,
Sri

Balakrishna N

unread,
Oct 22, 2013, 6:16:11 AM10/22/13
to forcecom-toolkit-f...@googlegroups.com
Hello,

I am getting following error while executing the code from developer console.
<internalReason>Invalid value ''. Values must match the following regular expression: 'ga:.+'</internalReason>

do you have any workaround for this.

Thanks,
Balakrishna

On Tuesday, April 23, 2013 6:26:12 PM UTC+5:30, vinoth wrote:

Matthew Botos

unread,
Oct 22, 2013, 9:26:38 AM10/22/13
to forcecom-toolkit-f...@googlegroups.com
Values for dimensions and metrics should start with "ga:", like "ga:pageviews".


--
You received this message because you are subscribed to the Google Groups "Force.com Toolkit For Google Analytics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to forcecom-toolkit-for-goo...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Balakrishna N

unread,
Oct 23, 2013, 1:32:41 AM10/23/13
to forcecom-toolkit-f...@googlegroups.com
Hi Matthew,

Verified related values start with "ga:" in GoogleAnalytics class. Can you please guide me how to overcome the issue. It will be great if you provide details!
  • ImportGoogleAnalytics.importSingleMetric('customsettingname')
To unsubscribe from this group and stop receiving emails from it, send an email to forcecom-toolkit-for-google-analytics+unsubscribe@googlegroups.com.

Matthew Botos

unread,
Oct 23, 2013, 10:45:20 AM10/23/13
to forcecom-toolkit-f...@googlegroups.com
Google changed the way they handle nulls, so this required some changes to the toolkit. You can get the latest version here:


To unsubscribe from this group and stop receiving emails from it, send an email to forcecom-toolkit-for-goo...@googlegroups.com.

Balakrishna N

unread,
Oct 28, 2013, 1:09:46 AM10/28/13
to forcecom-toolkit-f...@googlegroups.com
Hi Matthew,

Installed latest version from
https://github.com/mbotos/Force.com-Toolkit-for-Google-Analytics and executed the script from developer console, still facing same issue (Values must match the following regular expression: 'ga:.+' : ).

For more information, copied actual error from debug log. you will get better idea to see this log.
22:02:54.654 (654461000)|CALLOUT_REQUEST|[428]|System.HttpRequest[Endpoint=https://www.google.com/analytics/feeds/data?start-date=2011-01-01&end-date=2011-03-31&dimensions=&metrics=ga:visitors&filters=&prettyprint=true&ids=ga:78090869, Method=GET]
22:02:54.884 (884884000)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:682
22:02:54.884 (884976000)|CALLOUT_RESPONSE|[428]|System.HttpResponse[Status=Bad Request, StatusCode=400]

Your help much needed on this scneario.

Matthew Botos

unread,
Oct 28, 2013, 11:47:00 AM10/28/13
to forcecom-toolkit-f...@googlegroups.com
Thanks for including the callout URL from your debug log; that shows that empty parameters are still being passed, which Google no longer accepts. The URL should be not have the empty dimensions or filters parameters.

Sometimes it's difficult to sync GitHub to the Force.com IDE to Salesforce with updates, so I'd recommend manually checking the copy of the GoogleAnalytics Apex Class in your org and making sure it matches this one around line 270:


To unsubscribe from this group and stop receiving emails from it, send an email to forcecom-toolkit-for-goo...@googlegroups.com.

Balakrishna Nagineni

unread,
Oct 29, 2013, 1:05:44 PM10/29/13
to forcecom-toolkit-f...@googlegroups.com
Hi Mathhew,

Thank you very much for the update. I have updated 'GoogleAnalytics' latest class and executed. The earlier issue was solved but another issue coming as below.

System.ListException: List index out of bounds: 0: Class.GoogleAnalytics.getEntry: line 301, column 1 Class.GoogleAnalytics.getEntry: line 297, column 1 Class.GoogleAnalytics.getEntry: line 293, column 1 Class.ImportGoogleAnalytics.importSingleMetric: line 27, column 1 AnonymousBlock: line 1, column 1 AnonymousBlock: line 1, column 1

Debug log:
10:02:30.995 (995078000)|METHOD_EXIT|[27]|01p90000003bg6U|GoogleAnalytics.getEntry(Site_Metric_Date__c, LIST<String>)
10:02:30.995 (995085000)|METHOD_EXIT|[1]|01p90000003bg6Y|ImportGoogleAnalytics.importSingleMetric(String)
10:02:30.995 (995095000)|SYSTEM_MODE_EXIT|false
10:02:30.995 (995218000)|FATAL_ERROR|System.ListException: List index out of bounds: 0

Class.GoogleAnalytics.getEntry: line 301, column 1
Class.GoogleAnalytics.getEntry: line 297, column 1
Class.GoogleAnalytics.getEntry: line 293, column 1
Class.ImportGoogleAnalytics.importSingleMetric: line 27, column 1

Plz provide the solution if you have ready.

Matthew Botos

unread,
Oct 29, 2013, 3:08:20 PM10/29/13
to forcecom-toolkit-f...@googlegroups.com
I ran into the same error when requesting dates that didn't have any data; you'll probably have to modify ImportGoogleAnalytics with different dates.


To unsubscribe from this group and stop receiving emails from it, send an email to forcecom-toolkit-for-goo...@googlegroups.com.

Balakrishna N

unread,
Oct 30, 2013, 9:06:00 AM10/30/13
to forcecom-toolkit-f...@googlegroups.com
Thanks Mathhew. I will update the class and let you know if any issues.
Reply all
Reply to author
Forward
0 new messages