Optimally

API

Everything you can do in Optimally, a script can do. Make a token on your tokens page: one token works across every Harrowsoft product and can do what you can, no more. Send it like this:

curl https://harrowsoft.com/optimally/api/experiments -H "Authorization: Bearer hs_..."

Requests and answers are JSON. A problem comes back with a status code and a sentence: {"error": "That address doesn't look right."}

Make a test

curl -X POST https://harrowsoft.com/optimally/api/experiments -H "Authorization: Bearer hs_..." -H "content-type: application/json" \
  -d '{"site_id": 12, "name": "Bigger button", "url": "https://example.com/pricing"}'

Change a variation from code

A change is one of: {"t":"text","s":selector,"v":words}, {"t":"html","s":selector,"v":html}, {"t":"attr","s":selector,"k":name,"v":value}, {"t":"style","s":selector,"k":{property:value}}, {"t":"hide","s":selector}, {"t":"remove","s":selector}, {"t":"insert","s":selector,"pos":"before"|"after","v":html}, {"t":"move","s":selector,"to":selector,"pos":"before"|"after"}.

curl -X PATCH https://harrowsoft.com/optimally/api/experiment/88 -H "Authorization: Bearer hs_..." -H "content-type: application/json" -d '{"variations": [...]}'

On your page

optimally.track("purchase", {revenue: 24.50});  // a goal, with money
optimally.variation(88);                        // which version this person sees, or null
optimally.optOut();                             // this person is out of everything

Endpoints

GET /sitesYour sites, with their script keys and flicker numbers.
POST /sitesAdd a site: name, url.
PATCH /site/{id}Change its name or address.
DELETE /site/{id}Remove it, with its tests. Admins only.
GET /experimentsAll tests, each with its verdict. ?site= narrows it.
POST /experimentsMake a test: site_id, name, url, hypothesis.
GET /experiment/{id}One test.
PATCH /experiment/{id}Change name, hypothesis, pages, audience_id, traffic, variations or goals.
DELETE /experiment/{id}Delete a test that isn't running.
POST /experiment/{id}/statusstatus: running, paused or ended.
POST /experiment/{id}/shipvariation: everyone sees it from now on. null stops that.
POST /experiment/{id}/copyCopy into a new draft.
POST /experiment/{id}/edit-linkA link that opens the editor on the page. Good for a day.
GET /experiment/{id}/resultsThe verdict, each goal by version, and the day-by-day series.
GET /goalsGoals, with fourteen days of counts.
POST /goalsname, site_id, kind (click, page, custom), selector, url, event, revenue.
PATCH /goal/{id}The same fields.
DELETE /goal/{id}Delete a goal no live test uses.
GET /audiencesAudiences and their rules.
POST /audiencesname, rules.
PATCH /audience/{id}The same fields.
DELETE /audience/{id}Delete one no running test uses.
POST /import/optimizelytoken, project_id, site_id. Admins only.
GET /importsHow the last imports went.
GET /auditWho changed what. Admins only.