Skip to content

Commit

Permalink
Add region tags and readme (#1634)
Browse files Browse the repository at this point in the history
  • Loading branch information
averikitsch authored and bradmiro committed Nov 15, 2019
1 parent 2b25806 commit 2b1617f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
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>

0 comments on commit 2b1617f

Please sign in to comment.