o7tracker is high-performance click tracker designed for Google App Engine written in Go.
Make sure you have Google App Engine SDK for Go installed. Then you can run:
AUTH_USER=admin AUTH_PASSWORD=admin goapp serve -clear_datastoreAUTH_USERandAUTH_PASSWORDare settings for HTTP basic authentication.- For producton environment please see app.yaml.
-clear_datastoreflag make sure that local Datastore is clean.
And deploy with
appcfg.py -A <app_name> -V v1 update ./Tracker should be up and running on
curl <app_name>.appspot.comTracker exposes one endpoint that requires presence of campaign_id and platform.
GET /track/:id?platform=Android
Admin campaigns API requires HTTP basic authentication on all following endpoints:
POST /admin/campains
With following JSON payload:
{
"redirect_url":"https://github.com/otobrglez/o7tracker",
"platforms":[
"WindowsPhone", "Android", "IPhone"
]
}Result:
{
"id": 5928566696968192,
"redirect_url": "https://github.com/otobrglez/o7tracker",
"created_at": "2016-04-10T21:47:44.519184234Z",
"updated_at": "2016-04-10T21:47:44.519184189Z",
"platforms": [
"WindowsPhone",
"Android",
"IPhone"
],
"click_count": 0,
"android_click_count": 0,
"iphone_click_count": 0,
"windowsphone_click_count": 0
}Other endpoints:
GET /admin/campains/:id
GET /admin/campains?platforms=Android,WindowsPhone
PUT /admin/campains/:id
DELETE /admin/campains/:id
Help yourself with following Postman examples:
- This project assumes that Go is the fastest citizen of Google App Engine and fits perfectly for this particular task.
- This project uses layered caching with sequence
memcache > datastore. - Further optimisation could also be to parse
User-Agentfrom browser instead of relaying on?platform= - Further optimisation could be to stream clicks into
InfluxDBto get real-time overview of clicks. - Further optimisation in caching could also introduce global slice variable. However that would require some additional work to support cases like deletion of campaigns.
- Code comes with test suite for main components in repository
- and integration test written in Bash.