High-performance click tracker designed for Google App Engine written in Go.
Go Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.editorconfig
.gitignore
.travis.yml
README.md
admin_campaigns.go
app.go
app.yaml
click_track.go
cron.yaml
index.yaml
integration_test.sh
models.go
repository.go
repository_test.go
tasks.go
utils.go

README.md

o7tracker

o7tracker is high-performance click tracker designed for Google App Engine written in Go.

Build Status

Development & Setup

Make sure you have Google App Engine SDK for Go installed. Then you can run:

AUTH_USER=admin AUTH_PASSWORD=admin goapp serve -clear_datastore
  • AUTH_USER and AUTH_PASSWORD are settings for HTTP basic authentication.
  • For producton environment please see app.yaml.
  • -clear_datastore flag 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.com

APIs

Tracker API

Tracker exposes one endpoint that requires presence of campaign_id and platform.

GET /track/:id?platform=Android

Admin API

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:

Run in Postman

Assumptions

  • 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-Agent from browser instead of relaying on ?platform=
  • Further optimisation could be to stream clicks into InfluxDB to 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.

Testing

Author