{"_id":"57b96d6c1d08500e00bf8226","category":{"_id":"57b96d6b1d08500e00bf81d3","project":"54861bb654b3ce0b00367292","version":"57b96d6b1d08500e00bf81d1","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-12-08T21:55:25.679Z","from_sync":false,"order":1,"slug":"1-setup","title":"iOS / App Triggers"},"user":"54861b9f3681d914006992a4","__v":1,"parentDoc":null,"project":"54861bb654b3ce0b00367292","version":{"_id":"57b96d6b1d08500e00bf81d1","__v":7,"project":"54861bb654b3ce0b00367292","createdAt":"2016-08-21T08:59:23.326Z","releaseDate":"2016-08-21T08:59:23.326Z","categories":["57b96d6b1d08500e00bf81d2","57b96d6b1d08500e00bf81d3","57b96d6b1d08500e00bf81d4","57b96d6b1d08500e00bf81d5","57b96d6b1d08500e00bf81d6","57b96d6b1d08500e00bf81d7","57b96d6b1d08500e00bf81d8","57b96d6b1d08500e00bf81d9","57b96d6b1d08500e00bf81da","57b96d6b1d08500e00bf81db","57b96d6b1d08500e00bf81dc","57b97748306b9b0e001dd53f","57d12c6c1227b40e0044908a","57d51ad68191880e008bb51b","57d52b5cf350090e00fe073e","57d5468a17b492170053a3f0","57df9df05927cb0e002bce1e"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"","version_clean":"4.0.0","version":"4.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-08T14:54:46.938Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"You can share information to drive deeper personalization capabilities, user data, user behavior and source attribution\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Prior to starting the initial session:\"\n}\n[/block]\nIn order to apply these configurations, change the following code in your app delegate as following: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (BOOL)application:(UIApplication *)application \\n  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\\n   // Override point for customization after application launch.\\n    \\n  // basic setup\\n  [ElastiCode setAPIKey::::at:::\\\"<APIKey>\\\"]; \\n    \\n  // app triggers basic setup  \\n\\tECSessionParams* params = [ECSessionParams createInProduction:NO];\\n\\n  // apply configurations...\\n  \\n  [ElastiCode setSessionParams:params];\\n\\t[ElastiCode ready];\\n  return YES;\\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"class AppDelegate: UIResponder, UIApplicationDelegate {\\nvar window: UIWindow?\\n\\nfunc application(application: UIApplication, didFinishLaunchingWithOptions\\n       launchOptions: [NSObject: AnyObject]?) -> Bool {\\n    // Override point for customization after application launch.\\n    \\n    // basic setup\\n   \\tElastiCode.setAPIKey(\\\"<APIKey>\\\")\\n    \\n    // app triggers basic setup\\n\\t\\tlet params:ECSessionParams = ECSessionParams .createInProduction(false)\\n\\n\\t\\t// apply configurations...    \\n    \\n    ElastiCode.setSessionParams(params)\\n    ElastiCode.ready()\\n    return true\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n\n1.Key value attribution (bool , int , double  , string)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[params.data addSessionAttributes:(NSDictionary*)];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"params.data .addSessionAttributes([NSObject : AnyObject])\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n2. [Source Attribution](doc:source-attr) \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[params.data addSessionAppsFlyerAttributes:(NSDictionary*)];\\n\\n[params.data addSessionBranchIOAttributes:(NSDictionary*)];\\n\\n[params.data addSessionButtonAttributes:(NSDictionary*)];\\n\\n[params.data addSessionAdjustAttributes:(NSDictionary*)];\\n\\n[params.data addSessionKochavaAttributes:(NSDictionary*)];\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"params.data .addSessionAppsFlyerAttributes([NSObject : AnyObject])\\n\\nparams.data .addSessionBranchIOAttributes([NSObject : AnyObject])\\n\\nparams.data .addSessionButtonAttributes([NSObject : AnyObject])\\n\\nparams.data .addSessionAdjustAttributes([NSObject : AnyObject])\\n\\nparams.data .addSessionKochavaAttributes([NSObject : AnyObject])\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Post initial session setup\"\n}\n[/block]\nIn addition, there are three relevant fixed types of information, or any key-value parameter.\n\nFor example: Males, between 20-25, US residents, using iOS7, who downloaded 3 social apps and have entered your app 4 times this week - will receive alternative A.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Key (String)\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description/Example\",\n    \"0-0\": \"Age\",\n    \"0-1\": \"Double\",\n    \"0-2\": \"20, 30.5, 40.05, etc...\",\n    \"1-0\": \"Gender\",\n    \"1-1\": \"Int\",\n    \"1-2\": \"0 - Male, 1 - Female\",\n    \"2-0\": \"Location\",\n    \"2-1\": \"String\",\n    \"2-2\": \"The coordinates formated as string (Left - Lat, Right - Lon): (37.70042180136,-81.84539998)\",\n    \"3-0\": \"[Your Key]\",\n    \"3-1\": \"bool  \\nint  \\ndouble  \\nstring\",\n    \"3-2\": \"Your own key - value\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Share your own parameters!\",\n  \"body\": \"You can add your own keys, but they should receive only Boolean, Integer, Double and String values.\"\n}\n[/block]\nUse the following methods to share the relevant user info:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[ElastiCode shareUserInfo:@{\\n  @\\\"Age\\\" : @(20.5),\\n  @\\\"Gender\\\" : @0,\\n  @\\\"Location\\\" : @\\\"(37.700421688980136,-81.84535319999998)\\\"\\n}];\",\n      \"language\": \"objectivec\",\n      \"name\": \"Objective-C\"\n    },\n    {\n      \"code\": \"var userInfo: [String: AnyObject] = [\\n  \\\"Age\\\" : 20,\\n\\t\\\"Gender\\\" : 0,\\n\\t\\\"Location\\\" : \\\"(37.700421688980136,-81.84535319999998)\\\"\\n]\\nElastiCode .shareUserInfo(userInfo)\",\n      \"language\": \"objectivec\",\n      \"name\": \"Swift\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Adding events [post initial session setup]\"\n}\n[/block]\nYou can use the *event *method to share about user behaviors:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \" [ElastiCode event:@\\\"finished registration flow\\\"];\",\n      \"language\": \"objectivec\",\n      \"name\": \"Objective-C\"\n    },\n    {\n      \"code\": \"ElastiCode .event(\\\"finished registration flow\\\") \",\n      \"language\": \"text\",\n      \"name\": \"Swift\"\n    }\n  ]\n}\n[/block]\nYou can also add parameters to that event:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[ElastiCode event:@\\\"finished registration flow\\\"\\n attributes:@{\\n   @\\\"timePassed\\\" : @(30)\\n }];\",\n      \"language\": \"objectivec\",\n      \"name\": \"Objective-C\"\n    },\n    {\n      \"code\": \"var attributes: [String: AnyObject] = [\\\"timePassed\\\" : 30]\\nElastiCode .event(\\\"finished registration flow\\\", attributes: attributes) \",\n      \"language\": \"objectivec\",\n      \"name\": \"Swift\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"You can add your own keys, but they should receive only Boolean, Integer, Double and String values.\",\n  \"title\": \"Share your own parameters!\"\n}\n[/block]","excerpt":"IOS / APP TRIGGERS: User infomration","slug":"sharing-information","type":"basic","title":"User infomration"}

User infomration

IOS / APP TRIGGERS: User infomration

You can share information to drive deeper personalization capabilities, user data, user behavior and source attribution [block:api-header] { "type": "basic", "title": "Prior to starting the initial session:" } [/block] In order to apply these configurations, change the following code in your app delegate as following: [block:code] { "codes": [ { "code": "- (BOOL)application:(UIApplication *)application \n didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n // Override point for customization after application launch.\n \n // basic setup\n [ElastiCode setAPIKey:@\"<APIKey>\"]; \n \n // app triggers basic setup \n\tECSessionParams* params = [ECSessionParams createInProduction:NO];\n\n // apply configurations...\n \n [ElastiCode setSessionParams:params];\n\t[ElastiCode ready];\n return YES;\n}", "language": "objectivec" }, { "code": "class AppDelegate: UIResponder, UIApplicationDelegate {\nvar window: UIWindow?\n\nfunc application(application: UIApplication, didFinishLaunchingWithOptions\n launchOptions: [NSObject: AnyObject]?) -> Bool {\n // Override point for customization after application launch.\n \n // basic setup\n \tElastiCode.setAPIKey(\"<APIKey>\")\n \n // app triggers basic setup\n\t\tlet params:ECSessionParams = ECSessionParams .createInProduction(false)\n\n\t\t// apply configurations... \n \n ElastiCode.setSessionParams(params)\n ElastiCode.ready()\n return true\n}", "language": "swift" } ] } [/block] 1.Key value attribution (bool , int , double , string) [block:code] { "codes": [ { "code": "[params.data addSessionAttributes:(NSDictionary*)];", "language": "objectivec" }, { "code": "params.data .addSessionAttributes([NSObject : AnyObject])", "language": "swift" } ] } [/block] 2. [Source Attribution](doc:source-attr) [block:code] { "codes": [ { "code": "[params.data addSessionAppsFlyerAttributes:(NSDictionary*)];\n\n[params.data addSessionBranchIOAttributes:(NSDictionary*)];\n\n[params.data addSessionButtonAttributes:(NSDictionary*)];\n\n[params.data addSessionAdjustAttributes:(NSDictionary*)];\n\n[params.data addSessionKochavaAttributes:(NSDictionary*)];", "language": "objectivec" }, { "code": "params.data .addSessionAppsFlyerAttributes([NSObject : AnyObject])\n\nparams.data .addSessionBranchIOAttributes([NSObject : AnyObject])\n\nparams.data .addSessionButtonAttributes([NSObject : AnyObject])\n\nparams.data .addSessionAdjustAttributes([NSObject : AnyObject])\n\nparams.data .addSessionKochavaAttributes([NSObject : AnyObject])", "language": "swift" } ] } [/block] [block:api-header] { "type": "basic", "title": "Post initial session setup" } [/block] In addition, there are three relevant fixed types of information, or any key-value parameter. For example: Males, between 20-25, US residents, using iOS7, who downloaded 3 social apps and have entered your app 4 times this week - will receive alternative A. [block:parameters] { "data": { "h-0": "Key (String)", "h-1": "Type", "h-2": "Description/Example", "0-0": "Age", "0-1": "Double", "0-2": "20, 30.5, 40.05, etc...", "1-0": "Gender", "1-1": "Int", "1-2": "0 - Male, 1 - Female", "2-0": "Location", "2-1": "String", "2-2": "The coordinates formated as string (Left - Lat, Right - Lon): (37.70042180136,-81.84539998)", "3-0": "[Your Key]", "3-1": "bool \nint \ndouble \nstring", "3-2": "Your own key - value" }, "cols": 3, "rows": 4 } [/block] [block:callout] { "type": "info", "title": "Share your own parameters!", "body": "You can add your own keys, but they should receive only Boolean, Integer, Double and String values." } [/block] Use the following methods to share the relevant user info: [block:code] { "codes": [ { "code": "[ElastiCode shareUserInfo:@{\n @\"Age\" : @(20.5),\n @\"Gender\" : @0,\n @\"Location\" : @\"(37.700421688980136,-81.84535319999998)\"\n}];", "language": "objectivec", "name": "Objective-C" }, { "code": "var userInfo: [String: AnyObject] = [\n \"Age\" : 20,\n\t\"Gender\" : 0,\n\t\"Location\" : \"(37.700421688980136,-81.84535319999998)\"\n]\nElastiCode .shareUserInfo(userInfo)", "language": "objectivec", "name": "Swift" } ] } [/block] [block:api-header] { "type": "basic", "title": "Adding events [post initial session setup]" } [/block] You can use the *event *method to share about user behaviors: [block:code] { "codes": [ { "code": " [ElastiCode event:@\"finished registration flow\"];", "language": "objectivec", "name": "Objective-C" }, { "code": "ElastiCode .event(\"finished registration flow\") ", "language": "text", "name": "Swift" } ] } [/block] You can also add parameters to that event: [block:code] { "codes": [ { "code": "[ElastiCode event:@\"finished registration flow\"\n attributes:@{\n @\"timePassed\" : @(30)\n }];", "language": "objectivec", "name": "Objective-C" }, { "code": "var attributes: [String: AnyObject] = [\"timePassed\" : 30]\nElastiCode .event(\"finished registration flow\", attributes: attributes) ", "language": "objectivec", "name": "Swift" } ] } [/block] [block:callout] { "type": "info", "body": "You can add your own keys, but they should receive only Boolean, Integer, Double and String values.", "title": "Share your own parameters!" } [/block]