{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"settings":"","params":[]},"next":{"description":"","pages":[]},"title":"Signup","type":"fn","slug":"signup","excerpt":"Indicates a new user has signed up for an account.","body":"[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Deprecated API Warning\",\n  \"body\": \"This page documents a no-longer supported version of the Boomtrain JavaScript Library (versions 4.x and below). The new `p13n.js` library, documented [here](https://boomtrain.readme.io/v1/docs/p13njs-getting-started) is the currently supported library for integrating with ZetaHub.\"\n}\n[/block]\nWhen a new user signs up for an account or identifies for the first time, call `signup`. This function will do the following automatically:\n\n1. [Identify](doc:identify) this user with the specified `user_id`, merging any anonymous browsing history for this user into the newly-created profile and ensuring that subsequent behavior is tracked to this identity.\n2. [Track an event](doc:track) called `started_membership` to indicate the signup along with any attributes of this signup event. This event can be useful for triggering welcome campaigns.\n3. [Set attributes](doc:set) or preferences for this user's new profile in the Boomtrain Marketing Engine.\n\nIf a different _identified_ user was browsing at the time this function is called, the new identity passed into this function will supersede the previous identity, and the newly signed-up user's identity will be used for subsequent behavioral tracking in this browser.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"_bt.signup(identifier, [attributes], [callback])\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe `signup` call has the following fields:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`identifier`\",\n    \"0-1\": \"Object\",\n    \"0-2\": \"An identifier for this new user, either a `user_id` or an `email` address. This value must be a case-insensitive unique identifier for your user. See Identifier Format below for details.\",\n    \"1-0\": \"`attributes` *optional*\",\n    \"1-1\": \"Object\",\n    \"1-2\": \"An object containing key:value pairs indicating attributes to be set on this user and tracked as metadata in the `started_membership` event. See Attributes Format below for more information.\",\n    \"2-0\": \"`callback` *optional*\",\n    \"2-1\": \"Function\",\n    \"2-2\": \"A function that is executed after this function completes and the browser is now identified according to the newly-signed up user.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Identifier Format\"\n}\n[/block]\nThe `signup` function allows you to mark a user signup with either a unique user ID or an email address. These must be specified exactly as either a `user_id` or an `email` property of the object, and only one of these two may be specified. When an `email` is specified, this email will be added to the `contacts` field for this user in the Boomtrain Marketing Engine.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"_bt.signup(\\n  {'user_id':'example_user'}, \\n  {'newsletter':true}\\n);\",\n      \"language\": \"javascript\",\n      \"name\": \"Sample Signup with User ID\"\n    },\n    {\n      \"code\": \"_bt.signup(\\n\\t{'email':'example:::at:::user.com'}, \\n  {'newsletter':true}\\n);\",\n      \"language\": \"javascript\",\n      \"name\": \"Sample Signup with Email Address\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Attributes Format\"\n}\n[/block]\nAttributes can be provided to be set as user attributes on the new user. These attributes will be attached to the user's profile in the Boomtrain Marketing Engine, and they will also be added as metadata on the `started_membership` event.\n\nWhile attributes can have any form, the following attributes are reserved and specially-handled by Boomtrain:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`first_name`\",\n    \"0-1\": \"String\",\n    \"0-2\": \"First name of the user.\",\n    \"1-0\": \"`last_name`\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Last name of the user.\",\n    \"2-0\": \"`email`\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Email address of the user. Note that this will be added as a contact to this user's profile in the Boomtrain Marketing Engine. Note that if a different `email` is provided in the `identifier` part of this call from this value, this field will be ignored.\",\n    \"3-0\": \"`signed_up_at`\",\n    \"3-1\": \"ISO-8601 Timestamp String\",\n    \"3-2\": \"Time at which this user signed up. Note that this attribute will be automatically set to the current timestamp if not provided.\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"_bt.signup(\\n\\t{ 'user_id':'example_user'}, \\n  {\\t'first_name': 'Marty',\\n  \\t'last_name': 'McFly',\\n    'signed_up_at': '1955-11-12T10:04:00+08:00'\\n    'email':'[email protected]',\\n    'newsletter':true,\\n    'favorite_car':'DeLorean',\\n    'soundtrack':'Power of Love',\\n    'friends': ['Doc Brown', 'Einstein', 'Jennifer'],\\n    'rivals': ['Biff Tannen', 'Principal Strickland']\\n  },\\n  callbacktothefuture()\\n);\",\n      \"language\": \"javascript\",\n      \"name\": \"Sample Signup with Attributes\"\n    }\n  ]\n}\n[/block]","updates":[],"order":4,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5928a0a132b10a0f0042ae8c","parentDoc":null,"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Zeta JavaScript Library (versions 4.x and lower)","slug":"boomtrain-javascript-sdk","order":4,"from_sync":false,"reference":false,"_id":"59288c65e2653627003e1221","createdAt":"2017-05-26T20:13:25.882Z","project":"56aff08c3a5b810d00745d99","version":"56aff08c3a5b810d00745d9c","__v":0},"createdAt":"2017-05-26T21:39:45.228Z","githubsync":"","user":"566887ff8639090d00759415","version":{"version":"1","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["56aff08d3a5b810d00745d9d","56aff24f3a5b810d00745da0","56aff25dbc304a0d00ace207","56aff287e0b1e40d00c53798","56aff2b260a37a0d00ed8883","56aff2b8e0b1e40d00c53799","56aff2bd5b1f01170014dc7b","56aff2c9d21e9c0d00b62993","56aff493aef9a21700da0e67","56aff4ce1486990d009c0f64","56aff4da5b1f01170014dc7d","56aff4dfe0b1e40d00c537a2","56aff4e59d32e30d0006d3e9","56aff4e91486990d009c0f65","56aff4f93a5b810d00745da2","56aff4fe9d32e30d0006d3ea","56b91c7ab1e03e0d001057c5","56c4f51aba4a540d0091b9a2","56cd09488c4a331d002c1e44","56d4ec4773dcd20b00fb8769","56e79bc515f96b2200878e54","56ec25c538ff1d2200d56cc2","56ec3a6f36bc8e0e00f190c8","56ec3e308ea7ce0e00a3d8b0","5724d8fe4255580e005938b2","5724dc842ad0bc1700122803","5776ef2a04f7500e0095dc37","57ab9f70b5e8742000e17eb9","57d7117646dcc30e007dd21f","58e6abd5b1eece19008b7d31","59288c65e2653627003e1221","5a8f4797a44f8600128e75ee","5bbf8833eb416300039a2c14","5ea811617bf4b5007328a0af"],"_id":"56aff08c3a5b810d00745d9c","project":"56aff08c3a5b810d00745d99","releaseDate":"2016-02-01T23:55:56.544Z","__v":34,"createdAt":"2016-02-01T23:55:56.544Z"},"project":"56aff08c3a5b810d00745d99","__v":0}

Signup

Indicates a new user has signed up for an account.

[block:callout] { "type": "danger", "title": "Deprecated API Warning", "body": "This page documents a no-longer supported version of the Boomtrain JavaScript Library (versions 4.x and below). The new `p13n.js` library, documented [here](https://boomtrain.readme.io/v1/docs/p13njs-getting-started) is the currently supported library for integrating with ZetaHub." } [/block] When a new user signs up for an account or identifies for the first time, call `signup`. This function will do the following automatically: 1. [Identify](doc:identify) this user with the specified `user_id`, merging any anonymous browsing history for this user into the newly-created profile and ensuring that subsequent behavior is tracked to this identity. 2. [Track an event](doc:track) called `started_membership` to indicate the signup along with any attributes of this signup event. This event can be useful for triggering welcome campaigns. 3. [Set attributes](doc:set) or preferences for this user's new profile in the Boomtrain Marketing Engine. If a different _identified_ user was browsing at the time this function is called, the new identity passed into this function will supersede the previous identity, and the newly signed-up user's identity will be used for subsequent behavioral tracking in this browser. [block:code] { "codes": [ { "code": "_bt.signup(identifier, [attributes], [callback])", "language": "javascript" } ] } [/block] The `signup` call has the following fields: [block:parameters] { "data": { "h-0": "Field", "h-2": "Description", "0-0": "`identifier`", "0-1": "Object", "0-2": "An identifier for this new user, either a `user_id` or an `email` address. This value must be a case-insensitive unique identifier for your user. See Identifier Format below for details.", "1-0": "`attributes` *optional*", "1-1": "Object", "1-2": "An object containing key:value pairs indicating attributes to be set on this user and tracked as metadata in the `started_membership` event. See Attributes Format below for more information.", "2-0": "`callback` *optional*", "2-1": "Function", "2-2": "A function that is executed after this function completes and the browser is now identified according to the newly-signed up user." }, "cols": 3, "rows": 3 } [/block] [block:api-header] { "title": "Identifier Format" } [/block] The `signup` function allows you to mark a user signup with either a unique user ID or an email address. These must be specified exactly as either a `user_id` or an `email` property of the object, and only one of these two may be specified. When an `email` is specified, this email will be added to the `contacts` field for this user in the Boomtrain Marketing Engine. [block:code] { "codes": [ { "code": "_bt.signup(\n {'user_id':'example_user'}, \n {'newsletter':true}\n);", "language": "javascript", "name": "Sample Signup with User ID" }, { "code": "_bt.signup(\n\t{'email':'[email protected]'}, \n {'newsletter':true}\n);", "language": "javascript", "name": "Sample Signup with Email Address" } ] } [/block] [block:api-header] { "title": "Attributes Format" } [/block] Attributes can be provided to be set as user attributes on the new user. These attributes will be attached to the user's profile in the Boomtrain Marketing Engine, and they will also be added as metadata on the `started_membership` event. While attributes can have any form, the following attributes are reserved and specially-handled by Boomtrain: [block:parameters] { "data": { "h-0": "Field", "h-1": "", "h-2": "Description", "0-0": "`first_name`", "0-1": "String", "0-2": "First name of the user.", "1-0": "`last_name`", "1-1": "String", "1-2": "Last name of the user.", "2-0": "`email`", "2-1": "String", "2-2": "Email address of the user. Note that this will be added as a contact to this user's profile in the Boomtrain Marketing Engine. Note that if a different `email` is provided in the `identifier` part of this call from this value, this field will be ignored.", "3-0": "`signed_up_at`", "3-1": "ISO-8601 Timestamp String", "3-2": "Time at which this user signed up. Note that this attribute will be automatically set to the current timestamp if not provided." }, "cols": 3, "rows": 4 } [/block] [block:code] { "codes": [ { "code": "_bt.signup(\n\t{ 'user_id':'example_user'}, \n {\t'first_name': 'Marty',\n \t'last_name': 'McFly',\n 'signed_up_at': '1955-11-12T10:04:00+08:00'\n 'email':'[email protected]',\n 'newsletter':true,\n 'favorite_car':'DeLorean',\n 'soundtrack':'Power of Love',\n 'friends': ['Doc Brown', 'Einstein', 'Jennifer'],\n 'rivals': ['Biff Tannen', 'Principal Strickland']\n },\n callbacktothefuture()\n);", "language": "javascript", "name": "Sample Signup with Attributes" } ] } [/block]