{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/Attribution.track(event, [properties], [callback]);","auth":"required","settings":"","results":{"codes":[]},"examples":{"codes":[{"language":"javascript","code":"Attribution.track(event, [properties], [callback]);","name":""}]},"params":[{"name":"event","type":"string","default":"","desc":"The name of the event","required":true,"in":"body","ref":"","_id":"560ca0517048021700e180e9"},{"name":"properties","type":"object","default":"","desc":"A hashtable of properties describing the event.","required":false,"in":"body","ref":"","_id":"560ca0517048021700e180e8"},{"name":"callback","type":"object","default":"","desc":"A callback function that gets called after a short timeout.","required":false,"in":"body","ref":"","_id":"560ca0517048021700e180e7"}]},"next":{"description":"","pages":[]},"title":"Alias","type":"fn","slug":"alias","excerpt":"alias is used to merge two user identities, effectively connecting two sets of user data as one. It is an advanced method and is not necessary for most integrations.","body":"There are two main use cases for \"alias\" method:\n\n1) used to when you really want to merge two use data into one, this could be if your user moved/created new account (for example due to technical issues) but you still want to see the whole hist history as one user.\n\n2) you are doing \"identify\" call only on server-side. In this case would need **previousId** parameter to be Anonymous ID which you can access from JS snippet by calling **Attribution.user().anonymousId();** (this method is not recommended unless you have specific needs and understand what you are doing).\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"Attribution.alias([userId], [previousId], [callback]);\",\n \"language\": \"javascript\"\n }\n ]\n}\n[/block]\n\n[block:parameters]\n{\n \"data\": {\n \"0-0\": \"**userId **\\n*String, required*\",\n \"0-1\": \"The new User ID you want to associate the user with.\",\n \"1-0\": \"**previousId **\\n*String, required*\",\n \"1-1\": \"The previous ID that the user was recognized by.\",\n \"2-1\": \"A callback function that gets called after a short timeout.\",\n \"2-0\": \"**callback **\\n*Object, optional*\"\n },\n \"cols\": 2,\n \"rows\": 3\n}\n[/block]\n\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"Attribution.alias('00812938', '00812939');\",\n \"language\": \"javascript\"\n }\n ]\n}\n[/block]","updates":[],"order":3,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"560d769505b3941700338762","project":"560c93ad7e9b9d0d00ca81a2","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["560c93af7e9b9d0d00ca81a6","560c9d9399bb5a0d0044f220","560d76d899bb5a0d0044f307","560d76ee1ec45619006069ed","560d86e099bb5a0d0044f32e","560dba80373c0e0d0024ff3b","57c722ecdf19130e001fba5d","57c743d1b6f94a2200659903","58995ec083f743190077bbe2","5fabfb070e9b0600424707dd","60004359deee820012dc1efc","600060c72dcd9d002fa13656","6001ac08c104fe002b933b7c","6009604d81b288001417df30","60097b7be8ec1e00334419f6","600aa98de28fae003a33108a","600aa9ee7d3e350018e7d6e4"],"_id":"560c93ae7e9b9d0d00ca81a5","project":"560c93ad7e9b9d0d00ca81a2","createdAt":"2015-10-01T02:00:14.709Z","releaseDate":"2015-10-01T02:00:14.709Z","__v":17},"category":{"sync":{"isSync":false,"url":""},"pages":["560ca0517048021700e180e6","560d6190af9723190093812c","560d74751ec45619006069e9","560d769505b3941700338762"],"title":"JavaScript API (client-side)","slug":"javascript-api-client-side","order":7,"from_sync":false,"reference":true,"_id":"560c9d9399bb5a0d0044f220","project":"560c93ad7e9b9d0d00ca81a2","version":"560c93ae7e9b9d0d00ca81a5","__v":4,"createdAt":"2015-10-01T02:42:27.154Z"},"createdAt":"2015-10-01T18:08:21.010Z","githubsync":"","user":"560c92f2ac2859170013faa3","__v":1,"editedParams":true,"editedParams2":true,"parentDoc":null}
Alias
alias is used to merge two user identities, effectively connecting two sets of user data as one. It is an advanced method and is not necessary for most integrations.