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 /sites | Your sites, with their script keys and flicker numbers. |
| POST /sites | Add a site: name, url. |
| PATCH /site/{id} | Change its name or address. |
| DELETE /site/{id} | Remove it, with its tests. Admins only. |
| GET /experiments | All tests, each with its verdict. ?site= narrows it. |
| POST /experiments | Make 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}/status | status: running, paused or ended. |
| POST /experiment/{id}/ship | variation: everyone sees it from now on. null stops that. |
| POST /experiment/{id}/copy | Copy into a new draft. |
| POST /experiment/{id}/edit-link | A link that opens the editor on the page. Good for a day. |
| GET /experiment/{id}/results | The verdict, each goal by version, and the day-by-day series. |
| GET /goals | Goals, with fourteen days of counts. |
| POST /goals | name, 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 /audiences | Audiences and their rules. |
| POST /audiences | name, rules. |
| PATCH /audience/{id} | The same fields. |
| DELETE /audience/{id} | Delete one no running test uses. |
| POST /import/optimizely | token, project_id, site_id. Admins only. |
| GET /imports | How the last imports went. |
| GET /audit | Who changed what. Admins only. |