Force.com Toolkit for Google Analytics
For an easy, 1-click installation: Force.com Toolkit for Google Analytics on Code Share.
To use the source code with a Salesforce org: How To Use Github and the Force.com IDE
The toolkit contains the following elements for integrating Google Analytics data into Salesforce and Force.com applications:
- Site Metric Settings - login and table for Google Analytics
- Site Metric Date - date range or single date for a Site Metric
- Site Metric - a standard metric
- Site Event - a custom event
- GoogleAnalytics - methods to login, request, and parse analytics data into temporary Entry objects
- ImportGoogleAnalytics - sample import code; requires creation of Site Metric Settings
- SiteMetric_Time - populate human-readable time field for select metrics (ie. Average Time on Site)
- In Setup > Security Controls > Remote Site Settings, add the site https://www.google.com
- In Setup > Develop > Custom Settings, select Manage next to Site Metric Settings and enter your Google Analytics email and password
- To find the Table Id for your site, you can use the Google Analytics Data Feed Query Explorer
In the System Log, execute one of the following commands:
where name is a string with the name of the Custom Settings you created in Setup.
The result should be a series of Site Metric Date, Site Metric, and Site Event records. You may need to adjust the dates in ImportGoogleAnalytics to match activity dates for your site.
Help and Discussion
For help and discussion, please use the project's Google Group.