import "go.chromium.org/luci/server/analytics"
Package analytics provides a standard way to store the Google Analytics tracking ID.
This analytics package provides a convenient way to configure an analytics ID for an app. To use, just call analytics.ID(c) and inject that ID into a template.
import ( ... "go.chromium.org/luci/server/analytics" ... ) func myHandler(c context.Context, rw http.ResponseWriter, r *http.Request, p httprouter.Params) { ... return templates.Args{ "Analytics": analytics.Snippet(c), } }
And in the base html:
{{ .Analytics }}
analytics.go doc.go settings.go
ID returns the Google Analytics ID if it's set, and "" otherwise.
Snippet returns the html snippet for Google Analytics, including the <script> tag and ID, if ID is set.
Package analytics imports 7 packages (graph) and is imported by 3 packages. Updated 2019-12-07. Refresh now. Tools for package owners.