Created
February 3, 2015 15:14
-
-
Save ninnemana/387d8c7204214fa4557d to your computer and use it in GitHub Desktop.
Example of routing analytics using the Measurement Protocol in golang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "net/http" | |
| "net/url" | |
| ) | |
| func main() { | |
| vals := make(url.Values, 0) | |
| vals.Add("v", "1") | |
| vals.Add("tid", "UA-XXXXXX-1") | |
| vals.Add("cid", "555") | |
| vals.Add("t", "event") | |
| vals.Add("ec", "Part") | |
| vals.Add("ea", "GetPart") | |
| vals.Add("el", "dataType=JSON&partID=11000") | |
| vals.Add("ev", "200") | |
| for i := 0; i < 100000; i++ { | |
| if _, err := http.Get("http://www.google-analytics.com/collect?" + vals.Encode()); err != nil { | |
| panic(err) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment