{"_id":"5666d8b46819320d000c2e10","project":"54861bb654b3ce0b00367292","user":"54861b9f3681d914006992a4","__v":35,"category":{"_id":"562014108a05d7230006ffad","project":"54861bb654b3ce0b00367292","version":"5620140f8a05d7230006ffac","__v":18,"pages":["562014118a05d7230006ffb6","562014118a05d7230006ffb7","562014118a05d7230006ffb8","562014118a05d7230006ffb9","562014118a05d7230006ffba","562014118a05d7230006ffbb","562014118a05d7230006ffbc","562014118a05d7230006ffbd","562014118a05d7230006ffbe","562014118a05d7230006ffbf","562014118a05d7230006ffc0","5620146f8a05d72300070013","565ed96ff76b8d0d0055422b","565f1bb623fd5f0d00a12a51","565f2996413e06170093de98","565f29db0dc99e1900f24ba8","565f2b23649b951900c89724","565f2b5d413e06170093de9e","5666d8b46819320d000c2e10","5666dd1866debc1700503e38","5666e3da5d00370d00ede577","5666ef36f672550d000851aa","5666f1116819320d000c2e3e","5666f7bf6819320d000c2e53","5672d7fe3cab740d00d15a48","56e961cef3c3031900041af4","56ebc03943304e2900e2116f","56f116a0ab5e790e00fb3950"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-12-08T21:55:25.679Z","from_sync":false,"order":0,"slug":"1-setup","title":"Onboarding/Moment integration"},"parentDoc":null,"version":{"_id":"5620140f8a05d7230006ffac","project":"54861bb654b3ce0b00367292","__v":3,"createdAt":"2015-10-15T21:01:03.908Z","releaseDate":"2015-10-15T21:01:03.908Z","categories":["562014108a05d7230006ffad","562014108a05d7230006ffae","562014108a05d7230006ffaf","562014108a05d7230006ffb0","562014108a05d7230006ffb1","562014108a05d7230006ffb2","562014108a05d7230006ffb3","562014108a05d7230006ffb4","562014108a05d7230006ffb5","5666f7f5d784a70d00397bff","56967935b6d61f0d00acfb0b"],"is_deprecated":true,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"Moments","version_clean":"2.0.0","version":"2.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-08T13:18:44.215Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Completion / Close Block\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Before \\\"starting a session\\\"\",\n  \"body\": \"This method should​ be initiated before starting a new session\"\n}\n[/block]\nRun proprietary code when you  close the onboarding:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\n+ (void)startSession:(NSString*)elastiCodeApiKey \\n  onBoardingVersion:(NSString*)onBoardingVersion \\n  completionHandler:(nullable dispatch_block_t)completionBlock   \\n  skippedHandler:(nullable dispatch_block_t)skippedBlock;\\n\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func startSession(\\n\\telastiCodeApiKey: String, \\n\\tonBoardingVersion: String, \\n  completionHandler: dispatch_block_t?,\\n  skippedHandler: dispatch_block_t?)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Connection timeout\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Before \\\"starting a session\\\"\",\n  \"body\": \"This method should be initiated before starting a new session\"\n}\n[/block]\n\nThe maximum time the SDK awaits a response.\nDefault value: 20 seconds\n\nThe fallback protocol is displayed here: [[Advanced] Response protocol](doc:advanced-response-protocol) \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"+(void)setConnectionTimeout:(NSUInteger) timeout;\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func setConnectionTimeout(timeout: NSTimeInterval)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Image connection timeout\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Before \\\"starting a session\\\"\",\n  \"body\": \"This method should be initiated before starting a new session\"\n}\n[/block]\nThe maximum time the SDK awaits image downloads.\nDefault value: 5 seconds per Image\n\nThe fallback protocol is displayed here: [[Advanced] Response protocol](doc:advanced-response-protocol) \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"+(void)setImageDownloadTimeout:(NSUInteger) timeout;\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func setImageDownloadTimeout(timeout: UInt)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Session restart\"\n}\n[/block]\nOnce there is a need to re-sync interaction with elasticode server, just run this function and all relevant information would apply.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"+ (void)restartSession;\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func restartSession()\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Offline mode\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Read before implementing\",\n  \"body\": \"Once using this function you will not be able to update/change/a-b test/personalize in production, till the next version is resubmitted​ to production and goes live\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Before \\\"starting a session\\\"\",\n  \"body\": \"This method should be initiated before starting a new session\"\n}\n[/block]\nOffline mode allows you to build all experiences and run them locally on your device without connecting to the elasticode engine ( you need to export them to your device, more information on that is here: [Export an Experience](doc:export-an-experience) )\n\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"+ (void)offlineMode;\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func offlineMode()\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Disable Onboarding\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Before \\\"starting a session\\\"\",\n  \"body\": \"This method should be initiated before starting a new session\"\n}\n[/block]\nYou can disable onboarding all together via your code ( you can also do it VIA the dashboard instead) \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"+(void) disableOnBoarding:(BOOL) disable;\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func disableOnBoarding(disable: Bool)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Disable Onboarding on timeout\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Before \\\"starting a session\\\"\",\n  \"body\": \"This method should be initiated before starting a new session\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Relevant only if we have offline \\\"onboarding\\\" on the device\",\n  \"title\": \"If we have a local default experience\"\n}\n[/block]\nChoose to disable onboarding only when timeout occurs\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"+(void) onTimeoutDisableOnBoarding:(BOOL) disable;\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func onTimeoutDisableOnBoarding(disable: Bool)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Programatically Close an Onboarding\"\n}\n[/block]\nAlthough any action can achieve this via the dashboard, you can programmatically close any onboarding , and indicate if that onboarding was completed successfully\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"+(void) endMomentWithCompletion:(BOOL) completion;\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func endMomentWithCompletion(completion: Bool)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nAnd you can also use an addition completion block\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"+(void) endMomentWithCompletion:(BOOL) completion \\n  afterDismissBlock:(dispatch_block_t)dissmissBlock;\\n\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func endMomentWithCompletion(completion: Bool, \\nafterDismissBlock: dispatch_block_t)\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]","excerpt":"More information for your setup","slug":"setup-flow-advanced","type":"basic","title":"Onboarding  Setup (Advanced)"}

Onboarding Setup (Advanced)

More information for your setup

[block:api-header] { "type": "basic", "title": "Completion / Close Block" } [/block] [block:callout] { "type": "warning", "title": "Before \"starting a session\"", "body": "This method should​ be initiated before starting a new session" } [/block] Run proprietary code when you close the onboarding: [block:code] { "codes": [ { "code": "\n+ (void)startSession:(NSString*)elastiCodeApiKey \n onBoardingVersion:(NSString*)onBoardingVersion \n completionHandler:(nullable dispatch_block_t)completionBlock \n skippedHandler:(nullable dispatch_block_t)skippedBlock;\n", "language": "objectivec" }, { "code": "func startSession(\n\telastiCodeApiKey: String, \n\tonBoardingVersion: String, \n completionHandler: dispatch_block_t?,\n skippedHandler: dispatch_block_t?)", "language": "swift" } ] } [/block] [block:api-header] { "type": "basic", "title": "Connection timeout" } [/block] [block:callout] { "type": "warning", "title": "Before \"starting a session\"", "body": "This method should be initiated before starting a new session" } [/block] The maximum time the SDK awaits a response. Default value: 20 seconds The fallback protocol is displayed here: [[Advanced] Response protocol](doc:advanced-response-protocol) [block:code] { "codes": [ { "code": "+(void)setConnectionTimeout:(NSUInteger) timeout;", "language": "objectivec" }, { "code": "func setConnectionTimeout(timeout: NSTimeInterval)", "language": "swift" } ] } [/block] [block:api-header] { "type": "basic", "title": "Image connection timeout" } [/block] [block:callout] { "type": "warning", "title": "Before \"starting a session\"", "body": "This method should be initiated before starting a new session" } [/block] The maximum time the SDK awaits image downloads. Default value: 5 seconds per Image The fallback protocol is displayed here: [[Advanced] Response protocol](doc:advanced-response-protocol) [block:code] { "codes": [ { "code": "+(void)setImageDownloadTimeout:(NSUInteger) timeout;", "language": "objectivec" }, { "code": "func setImageDownloadTimeout(timeout: UInt)", "language": "swift" } ] } [/block] [block:api-header] { "type": "basic", "title": "Session restart" } [/block] Once there is a need to re-sync interaction with elasticode server, just run this function and all relevant information would apply. [block:code] { "codes": [ { "code": "+ (void)restartSession;", "language": "objectivec" }, { "code": "func restartSession()", "language": "swift" } ] } [/block] [block:api-header] { "type": "basic", "title": "Offline mode" } [/block] [block:callout] { "type": "danger", "title": "Read before implementing", "body": "Once using this function you will not be able to update/change/a-b test/personalize in production, till the next version is resubmitted​ to production and goes live" } [/block] [block:callout] { "type": "warning", "title": "Before \"starting a session\"", "body": "This method should be initiated before starting a new session" } [/block] Offline mode allows you to build all experiences and run them locally on your device without connecting to the elasticode engine ( you need to export them to your device, more information on that is here: [Export an Experience](doc:export-an-experience) ) [block:code] { "codes": [ { "code": "+ (void)offlineMode;", "language": "objectivec" }, { "code": "func offlineMode()", "language": "swift" } ] } [/block] [block:api-header] { "type": "basic", "title": "Disable Onboarding" } [/block] [block:callout] { "type": "warning", "title": "Before \"starting a session\"", "body": "This method should be initiated before starting a new session" } [/block] You can disable onboarding all together via your code ( you can also do it VIA the dashboard instead) [block:code] { "codes": [ { "code": "+(void) disableOnBoarding:(BOOL) disable;", "language": "objectivec" }, { "code": "func disableOnBoarding(disable: Bool)", "language": "swift" } ] } [/block] [block:api-header] { "type": "basic", "title": "Disable Onboarding on timeout" } [/block] [block:callout] { "type": "warning", "title": "Before \"starting a session\"", "body": "This method should be initiated before starting a new session" } [/block] [block:callout] { "type": "info", "body": "Relevant only if we have offline \"onboarding\" on the device", "title": "If we have a local default experience" } [/block] Choose to disable onboarding only when timeout occurs [block:code] { "codes": [ { "code": "+(void) onTimeoutDisableOnBoarding:(BOOL) disable;", "language": "objectivec" }, { "code": "func onTimeoutDisableOnBoarding(disable: Bool)", "language": "swift" } ] } [/block] [block:api-header] { "type": "basic", "title": "Programatically Close an Onboarding" } [/block] Although any action can achieve this via the dashboard, you can programmatically close any onboarding , and indicate if that onboarding was completed successfully [block:code] { "codes": [ { "code": "+(void) endMomentWithCompletion:(BOOL) completion;", "language": "objectivec" }, { "code": "func endMomentWithCompletion(completion: Bool)", "language": "swift" } ] } [/block] And you can also use an addition completion block [block:code] { "codes": [ { "code": "+(void) endMomentWithCompletion:(BOOL) completion \n afterDismissBlock:(dispatch_block_t)dissmissBlock;\n", "language": "objectivec" }, { "code": "func endMomentWithCompletion(completion: Bool, \nafterDismissBlock: dispatch_block_t)", "language": "swift" } ] } [/block]