Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add region tags and readme for Google Analytics #1634

Merged
merged 1 commit into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions appengine-java8/analytics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Google Analytics sample for Google App Engine

<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=appengine-java8/analytics/README.md">
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

Integrating App Engine with Google Analytics.

## Project setup, installation, and configuration

- Register for [Google Analytics](http://www.google.com/analytics/), create
an application, and get a tracking Id.
- [Find your tracking Id](https://support.google.com/analytics/answer/1008080?hl=en)
and set it as an environment variable in [`appengine-web.xml`](src/main/webapp/WEB-INF/appengine-web.xml).

## Running locally
This example uses the
[Maven Cloud SDK based plugin](https://cloud.google.com/appengine/docs/java/tools/using-maven).
To run this sample locally:

$ mvn appengine:run

## Deploying

$ mvn appengine:deploy
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.example.appengine.analytics;

// [START analytics_track]
import com.google.appengine.api.urlfetch.URLFetchService;
import com.google.appengine.api.urlfetch.URLFetchServiceFactory;
import java.io.IOException;
Expand Down Expand Up @@ -67,3 +68,4 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp)
resp.getWriter().println("Event tracked.");
}
}
// [END analytics_track]
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@
<env-var name="GA_TRACKING_ID" value="YOUR-GA-TRACKING-ID" />
</env-variables>
</appengine-web-app>