Import data from Google Analytics into Salesforce and applications for reports, dashboards, and mashups.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1 commit ahead of mavens:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
salesforce.schema Toolkit for Google Analytics


To use the source code with a Salesforce org: How To Use Github and the IDE

For admins, the toolkit now contains Shashidhar Gurumurthy's winning Admin App from the Mavens' CloudSpokes Challenge; instructions can be found in QuickStart.pdf.


The toolkit contains the following elements for integrating Google Analytics data into Salesforce and applications:

Custom Settings

  • Site Metric Settings - login and table for Google Analytics

Custom Objects

  • 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)


  1. In Setup > Security Controls > Remote Site Settings, add the site
  2. In Setup > Develop > Custom Settings, select Manage next to Site Metric Settings and enter your Google Analytics email and password
  3. To find the Table Id for your site, you can use the Google Analytics Data Feed Query Explorer

Run Samples

In the System Log, execute one of the following commands:

  • ImportGoogleAnalytics.importSingleMetric(name)
  • ImportGoogleAnalytics.importDailyMetrics(name)
  • ImportGoogleAnalytics.importEvents(name)

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.