-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add separate README files for Admin and Data API samples
- Loading branch information
Showing
4 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Google Analytics Admin API examples | ||
|
||
[![Open in Cloud Shell][shell_img]][shell_link] | ||
|
||
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png | ||
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/java-docs-samples&page=editor&open_in_editor=/google-analytics-admin/README.md | ||
|
||
These samples show how to use the | ||
[Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python. | ||
|
||
## Build and Run | ||
1. **Enable APIs** - [Enable the Analytics Data API](https://console.cloud.google.com/flows/enableapi?apiid=analyticsdata.googleapis.com) | ||
and create a new project or select an existing project. | ||
2. **Download The Credentials** - Configure your project using [Application Default Credentials][adc]. | ||
Click "Go to credentials" after enabling the APIs. Click "Create Credentials" | ||
and select "Service Account Credentials" and download the credentials file. Then set the path to | ||
this file to the environment variable `GOOGLE_APPLICATION_CREDENTIALS`: | ||
```sh | ||
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json | ||
``` | ||
3. **Clone the repo** and cd into this directory | ||
```sh | ||
git clone https://github.com/googleanalytics/java-docs-samples | ||
cd java-docs-samples/google-analytics-admin | ||
``` | ||
4. Confirm that [Maven](https://maven.apache.org) is installed | ||
```sh | ||
mvn --version | ||
``` | ||
5. **Review the comments starting with `TODO(developer)` and update the code | ||
to use correct values.** | ||
6. **Run** with the command `mvn compile exec:java | ||
-Dexec.mainClass=FULLY_QUALIFIED_SAMPLE_CLASS_NAME`. For example: | ||
```sh | ||
mvn -q compile exec:java -Dexec.mainClass='com.example.analytics.QuickstartSample' | ||
``` | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Google Analytics Data API examples | ||
|
||
[![Open in Cloud Shell][shell_img]][shell_link] | ||
|
||
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png | ||
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/java-docs-samples&page=editor&open_in_editor=/google-analytics-data/README.md | ||
|
||
These samples show how to use the | ||
[Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python. | ||
|
||
## Build and Run | ||
1. **Enable APIs** - [Enable the Analytics Data API](https://console.cloud.google.com/flows/enableapi?apiid=analyticsdata.googleapis.com) | ||
and create a new project or select an existing project. | ||
2. **Download The Credentials** - Configure your project using [Application Default Credentials][adc]. | ||
Click "Go to credentials" after enabling the APIs. Click "Create Credentials" | ||
and select "Service Account Credentials" and download the credentials file. Then set the path to | ||
this file to the environment variable `GOOGLE_APPLICATION_CREDENTIALS`: | ||
|
||
```sh | ||
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json | ||
``` | ||
3. **Clone the repo** and cd into this directory | ||
```sh | ||
git clone https://github.com/googleanalytics/java-docs-samples | ||
cd java-docs-samples/google-analytics-admin | ||
``` | ||
4. Confirm that [Maven](https://maven.apache.org) is installed | ||
```sh | ||
mvn --version | ||
``` | ||
5. **Review the comments starting with `TODO(developer)` and update the code | ||
to use correct values.** | ||
6. **Run** with the command `mvn compile exec:java | ||
-Dexec.mainClass=FULLY_QUALIFIED_SAMPLE_CLASS_NAME`. For example: | ||
```sh | ||
mvn -q compile exec:java -Dexec.mainClass='com.example.analytics.QuickstartSample' | ||
``` | ||
**Tip:** You can see the complete list of available samples in the | ||
[`src/main/java/com/example/analytics`][src/main/java/com/example/analytics] | ||
directory. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters