samples: update the sample to use the Google Analytics Data API v1 beta#164
Conversation
|
Warning: This pull request is touching the following templated files:
|
lesv
left a comment
There was a problem hiding this comment.
Please revert the copyright to the older date.
Also, mention that service accounts are usually not required in GCP production environments.
It's likely you'll need to mention me in the comment for me to see you are ready for a re-review.
Codecov Report
@@ Coverage Diff @@
## master #164 +/- ##
=========================================
Coverage 74.79% 74.79%
Complexity 104 104
=========================================
Files 12 12
Lines 738 738
Branches 2 2
=========================================
Hits 552 552
Misses 180 180
Partials 6 6 Continue to review full report at Codecov.
|
|
@chingor13 @lesv Apologies for a super delayed response, as we have discovered an issue with the proto and had to delay a Beta release. The PR is now ready for review. |
lesv
left a comment
There was a problem hiding this comment.
minor changes requested. Please ping me when you want a final LGTM
| /** | ||
| * TODO(developer): Uncomment this variable and replace with your | ||
| * Google Analytics 4 property ID before running the sample. | ||
| */ | ||
| // propertyId = "YOUR-GA4-PROPERTY-ID"; | ||
|
|
||
| // [START google_analytics_data_initialize] | ||
| /** TODO(developer): Uncomment this variable and replace with a valid path to | ||
| * the credentials.json file for your service account downloaded from the | ||
| * Cloud Console. | ||
| */ | ||
| // credentialsJsonPath = "/path/to/credentials.json"; | ||
|
|
||
| // Explicitly use service account credentials by specifying | ||
| // the private key file. |
There was a problem hiding this comment.
This isn't the way specified in the Sample Format guide or the canonical samples
FYI: each class can have a main(). This would be good to fix.
There was a problem hiding this comment.
I was hoping to maintain consistency between samples for different platforms, but your suggestion makes more sense. Thanks.
| public static void main(String... args) throws Exception { | ||
| sampleRunReport("YOUR-GA4-PROPERTY-ID", "/path/to/credentials.json"); | ||
| } | ||
| } |
There was a problem hiding this comment.
This ideally would be at the top and include the things you want users to modify.
There was a problem hiding this comment.
Makes sense. Done!
| public static void main(String... args) throws Exception { | ||
| // TODO(developer): Replace this variable with your GA4 property ID before running the sample. | ||
| String ga4PropertyId = "GA4 PROPERTY ID"; | ||
| sampleRunReport(ga4PropertyId); | ||
| sampleRunReport("YOUR-GA4-PROPERTY-ID"); | ||
| } |
There was a problem hiding this comment.
Again, you might wish to moe this above your class.
chingor13
left a comment
There was a problem hiding this comment.
Sample code LGTM, just a few comments about the snippet names
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> ☕️