Follow the below instructions to query Google Analytics data in the AdStage for Google Sheets add-on.
Step 1: Add {"provider", "google_analytics"} to your formula.
Step 2: Include the targets parameter and entity ID. Looks like this {"targets", "/network/google_analytics/profile/71902195"}
Find the entity ID by jumping into Google Analytics and finding the ID for your Google Analytics View. It is also one of the IDs listed in the URL when you're looking at that View in GA. In the Google Analytics UI it looks like this:
Step 3: Include metrics and dimensions from this resource. Popular examples are ga:sourceMedium, ga:sessions, ga:goalCompletionsAll, ga:newUsers.
Example formula:
=campaigns("last 7 days", {"ga:sourceMedium", "ga:sessions", "ga:goalCompletionsAll", "ga:newUsers"}, {"provider", "google_analytics"}, {"targets", "/network/google_analytics/profile/71902195"}, {"dimensions", "ga:sourceMedium"})
Troubleshooting Tips
You must provide at least two fields for Google Analytics requests
To include a date as a field use "date" as a field (as opposed to ga:day) and aggregate by a time period (day, week, month) using the aggregation parameter: {"aggregate by", "day"}
If you'd like to use "ga:date" instead of "date", please note that "ga:date" is a dimension, so you'll need to add in the following parameter, {"dimensions","ga:date"}
When using a secondary dimension use the following format, {"dimensions", "ga:date, ga:region"}
Need help? Feel free to reach out to us at support@adstage.io.