{"_id":"560d77ae772ec32d00fa585a","githubsync":"","project":"560c93ad7e9b9d0d00ca81a2","version":{"_id":"560c93ae7e9b9d0d00ca81a5","project":"560c93ad7e9b9d0d00ca81a2","__v":9,"createdAt":"2015-10-01T02:00:14.709Z","releaseDate":"2015-10-01T02:00:14.709Z","categories":["560c93af7e9b9d0d00ca81a6","560c9d9399bb5a0d0044f220","560d76d899bb5a0d0044f307","560d76ee1ec45619006069ed","560d86e099bb5a0d0044f32e","560dba80373c0e0d0024ff3b","57c722ecdf19130e001fba5d","57c743d1b6f94a2200659903","58995ec083f743190077bbe2"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"parentDoc":null,"category":{"_id":"560d76d899bb5a0d0044f307","__v":3,"pages":["560d77ae772ec32d00fa585a","560d77fa8bfb03170030ac12","569c7befd326c80d0068f78c"],"project":"560c93ad7e9b9d0d00ca81a2","version":"560c93ae7e9b9d0d00ca81a5","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-10-01T18:09:28.082Z","from_sync":false,"order":1,"slug":"http-api-server-side","title":"HTTP API (server-side)"},"user":"560c92f2ac2859170013faa3","__v":4,"metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-10-01T18:13:02.587Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"method":"post","results":{"codes":[]},"settings":"","examples":{"codes":[{"name":"","code":"curl https://track.attributionapp.com/track \\\n  -u YOUR_PROJECT_ID: \\\n  -d '{ \"user_id\": \"1234\", \"event\": \"Credit Card Charged\", \"properties\": { \"revenue\": 14.99 } }'","language":"shell"}]},"auth":"required","params":[],"url":"/track"},"isReference":true,"order":0,"body":"If you don't have **user_id** but still want to track event for anonymous user from server-side you need to pass **cookie_id** property which will contain anonymous user id. You can get from JavaScript by calling:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Attribution.user().anonymousId();\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nAttribution app uses a HTTP Auth for all server-side functions.\n\nYour HTTPS request header should have a blank password and the username must be your \"Project ID\" from [Attribution app settings](https://dashboard.attributionapp.com/#!/settings)\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/a50ad6a-Screen_Shot_2019-10-30_at_8.33.06_AM.png\",\n        \"Screen Shot 2019-10-30 at 8.33.06 AM.png\",\n        1440,\n        80,\n        \"#5cc38c\"\n      ]\n    }\n  ]\n}\n[/block]","excerpt":"Track has the same behavior on the server as it has from the client. The only difference is that you must specify the \"user_id\" when track is called from the server. Use the ID field from your database, the same you would in an identify call.","slug":"http-track","type":"endpoint","title":"/track"}

post/track

Track has the same behavior on the server as it has from the client. The only difference is that you must specify the "user_id" when track is called from the server. Use the ID field from your database, the same you would in an identify call.

Definition

{{ api_url }}{{ page_api_url }}

Examples


Documentation

If you don't have **user_id** but still want to track event for anonymous user from server-side you need to pass **cookie_id** property which will contain anonymous user id. You can get from JavaScript by calling: [block:code] { "codes": [ { "code": "Attribution.user().anonymousId();", "language": "javascript" } ] } [/block] Attribution app uses a HTTP Auth for all server-side functions. Your HTTPS request header should have a blank password and the username must be your "Project ID" from [Attribution app settings](https://dashboard.attributionapp.com/#!/settings) [block:image] { "images": [ { "image": [ "https://files.readme.io/a50ad6a-Screen_Shot_2019-10-30_at_8.33.06_AM.png", "Screen Shot 2019-10-30 at 8.33.06 AM.png", 1440, 80, "#5cc38c" ] } ] } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}