Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

samples: update the sample to use the Google Analytics Data API v1 beta#164

Merged
chingor13 merged 35 commits into
googleapis:masterfrom
ikuleshov:master
Mar 22, 2021
Merged

samples: update the sample to use the Google Analytics Data API v1 beta#164
chingor13 merged 35 commits into
googleapis:masterfrom
ikuleshov:master

Conversation

@ikuleshov

Copy link
Copy Markdown
Contributor

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:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

@ikuleshov ikuleshov requested review from a team February 27, 2021 02:12
@generated-files-bot

Copy link
Copy Markdown

Warning: This pull request is touching the following templated files:

  • samples/snippets/pom.xml

@product-auto-label product-auto-label Bot added the samples Issues that are directly related to samples. label Feb 27, 2021
@snippet-bot

snippet-bot Bot commented Feb 27, 2021

Copy link
Copy Markdown

Here is the summary of possible violations 😱

Details

There are 8 possible violations for not having product prefix.

The end of the violation section. All the stuff below is FYI purposes only.


Here is the summary of changes.

You are about to add 8 region tags.
You are about to delete 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Feb 27, 2021
Comment thread samples/snippets/src/main/java/com/example/analytics/QuickstartSample.java Outdated
Comment thread samples/snippets/src/main/java/com/example/analytics/QuickstartSample.java Outdated
Comment thread samples/snippets/src/main/java/com/example/analytics/QuickstartSample.java Outdated

@lesv lesv left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kurtisvg kurtisvg assigned lesv and unassigned kurtisvg Feb 28, 2021
Comment thread samples/snippets/src/main/java/com/example/analytics/QuickstartSample.java Outdated
@chingor13 chingor13 changed the title docs: update the sample to use the Google Analytics Data API v1 beta samples: update the sample to use the Google Analytics Data API v1 beta Mar 1, 2021
@codecov

codecov Bot commented Mar 18, 2021

Copy link
Copy Markdown

Codecov Report

Merging #164 (011b623) into master (94abd6a) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94abd6a...011b623. Read the comment docs.

@ikuleshov

Copy link
Copy Markdown
Contributor Author

@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.

@ikuleshov ikuleshov requested a review from chingor13 March 19, 2021 20:18

@lesv lesv left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor changes requested. Please ping me when you want a final LGTM

Comment on lines +52 to +66
/**
* 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping to maintain consistency between samples for different platforms, but your suggestion makes more sense. Thanks.

Comment on lines +104 to +107
public static void main(String... args) throws Exception {
sampleRunReport("YOUR-GA4-PROPERTY-ID", "/path/to/credentials.json");
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ideally would be at the top and include the things you want users to modify.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Done!

Comment on lines 84 to 86
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");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, you might wish to moe this above your class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@ikuleshov ikuleshov requested a review from lesv March 19, 2021 20:38

@chingor13 chingor13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample code LGTM, just a few comments about the snippet names

Comment thread samples/snippets/src/main/java/com/example/analytics/QuickstartSample.java Outdated
@ikuleshov ikuleshov requested a review from chingor13 March 22, 2021 18:55
@chingor13 chingor13 merged commit 76c52b9 into googleapis:master Mar 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants