From 65f92409444c67334c969e418af16f241ac6339f Mon Sep 17 00:00:00 2001 From: averikitsch Date: Tue, 22 Oct 2019 09:17:37 -0700 Subject: [PATCH] Add region tags and readme --- appengine-java8/analytics/README.md | 24 +++++++++++++++++++ .../appengine/analytics/AnalyticsServlet.java | 2 ++ .../src/main/webapp/WEB-INF/appengine-web.xml | 1 - 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 appengine-java8/analytics/README.md diff --git a/appengine-java8/analytics/README.md b/appengine-java8/analytics/README.md new file mode 100644 index 00000000000..de83edc28b5 --- /dev/null +++ b/appengine-java8/analytics/README.md @@ -0,0 +1,24 @@ +# Google Analytics sample for Google App Engine + + +Open in Cloud Shell + +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 diff --git a/appengine-java8/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java b/appengine-java8/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java index dcccd24926e..921099334ab 100644 --- a/appengine-java8/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java +++ b/appengine-java8/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java @@ -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; @@ -67,3 +68,4 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) resp.getWriter().println("Event tracked."); } } +// [END analytics_track] diff --git a/appengine-java8/analytics/src/main/webapp/WEB-INF/appengine-web.xml b/appengine-java8/analytics/src/main/webapp/WEB-INF/appengine-web.xml index 796dfaa0ddd..f5ca2262a85 100644 --- a/appengine-java8/analytics/src/main/webapp/WEB-INF/appengine-web.xml +++ b/appengine-java8/analytics/src/main/webapp/WEB-INF/appengine-web.xml @@ -20,4 +20,3 @@ -