| Index: appengine/gaemiddleware/settings.go
|
| diff --git a/appengine/gaemiddleware/settings.go b/appengine/gaemiddleware/settings.go
|
| index 349e724d8fb57aa038644ba4785348051ae4ba33..0efa118fe6409451917dada9ab32463d26ba989b 100644
|
| --- a/appengine/gaemiddleware/settings.go
|
| +++ b/appengine/gaemiddleware/settings.go
|
| @@ -32,6 +32,10 @@ type gaeSettings struct {
|
| // DisableDSCache is true to disable dscache (the memcache layer on top of
|
| // the datastore).
|
| DisableDSCache settings.YesOrNo `json:"disable_dscache"`
|
| +
|
| + // AnalyticsID is a Google Analytics ID an admin can set to enable Analytics.
|
| + // The app must support analytics for this to work.
|
| + AnalyticsID string `json:"analytics_id"`
|
| }
|
|
|
| // fetchCachedSettings fetches gaeSettings from the settings store or panics.
|
| @@ -54,6 +58,7 @@ func fetchCachedSettings(c context.Context) gaeSettings {
|
| return gaeSettings{
|
| LoggingLevel: logging.Debug,
|
| DisableDSCache: false,
|
| + AnalyticsID: "",
|
| }
|
| default:
|
| panic(fmt.Errorf("could not fetch GAE settings - %s", err))
|
| @@ -100,6 +105,14 @@ dscache documentation</a> for more information. Toggling this on and off has
|
| consequences: <b>memcache is completely flushed</b>. Do not toy with this
|
| setting.`,
|
| }),
|
| + {
|
| + ID: "AnalyticsID",
|
| + Title: "Google Analytics Trakcing ID",
|
| + Type: settings.UIFieldText,
|
| + Help: `Tracking ID used for Google Analytics. Filling this in does not
|
| +by itself add analytics to the app, it must be embedded in the HTML templates
|
| +by calling <TODO: WHAT?>`,
|
| + },
|
| }, nil
|
| }
|
|
|
| @@ -112,6 +125,7 @@ func (settingsUIPage) ReadSettings(c context.Context) (map[string]string, error)
|
| return map[string]string{
|
| "LoggingLevel": s.LoggingLevel.String(),
|
| "DisableDSCache": s.DisableDSCache.String(),
|
| + "AnalyticsID": s.AnalyticsID,
|
| }, nil
|
| }
|
|
|
| @@ -123,6 +137,7 @@ func (settingsUIPage) WriteSettings(c context.Context, values map[string]string,
|
| if err := modified.DisableDSCache.Set(values["DisableDSCache"]); err != nil {
|
| return err
|
| }
|
| + modified.AnalyticsID = values["AnalyticsID"]
|
|
|
| // When switching dscache back on, wipe memcache.
|
| existing := gaeSettings{}
|
|
|