{"_id":"588861fa165af631008ee1d5","user":"548d74b716fc980b00e2a786","project":"54861bb654b3ce0b00367292","version":{"_id":"588861fa165af631008ee1b8","__v":1,"project":"54861bb654b3ce0b00367292","createdAt":"2017-01-25T08:29:46.061Z","releaseDate":"2017-01-25T08:29:46.061Z","categories":["588861fa165af631008ee1b9","588861fa165af631008ee1ba","588861fa165af631008ee1bb","588861fa165af631008ee1bc","588861fa165af631008ee1bd","588861fa165af631008ee1be","588861fa165af631008ee1bf","588861fa165af631008ee1c0","588861fa165af631008ee1c1","588861fa165af631008ee1c2","588861fa165af631008ee1c3","588861fa165af631008ee1c4","588861fa165af631008ee1c5","588861fa165af631008ee1c6","588861fa165af631008ee1c7","588861fa165af631008ee1c8","588861fa165af631008ee1c9"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"5.0.0","version":"5.0"},"parentDoc":null,"__v":0,"category":{"_id":"588861fa165af631008ee1ba","__v":0,"version":"588861fa165af631008ee1b8","project":"54861bb654b3ce0b00367292","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"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-04-04T06:16:32.974Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":11,"body":"[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/tdcKFmgoTwmkNLcFXbH2_logo.png\",\n        \"logo.png\",\n        \"194\",\n        \"57\",\n        \"#0493cc\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nEasily integrate your **AppsFlyer** account to personalize based on the download-source, by doing the following:\n\nYou can create this helper method:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"-(void) startElasticodeWithAppsFlyerInstallData:(NSDictionary*) installData{\\n\\t[ElastiCode setAPIKey::::at:::\\\"<APIKey>\\\"]; \\n  ECSessionParams* params = [ECSessionParams createInProduction:NO];\\n  if(installData){\\n  \\t[params.data addSessionAppsFlyerAttributes:installData];\\n  }\\n  [ElastiCode setSessionParams:params];\\n  [EalstiCode ready];\\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func startElasticodeWithAppsFlyerInstallData(installData: [NSObject : AnyObject]?) {\\n\\tElastiCode.setAPIKey(\\\"<APIKey>\\\")\\n  let params:ECSessionParams = ECSessionParams .createInProduction(false)\\n \\tif let p = installData {\\n  \\tparams.data .addSessionAppsFlyerAttributes(p)\\n  }\\n\\tElastiCode.setSessionParams(params)\\n\\tElastiCode.ready()\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nSimply add the AppsFlyer methods to your `appDelegate` like so:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"-(void)onConversionDataReceived:(NSDictionary*) installData {\\n\\t[self startElasticodeWithAppsFlyerInstallData: installData];\\n}\\n\\n-(void)onConversionDataRequestFailure:(NSError *) error {\\n\\t[self startElasticodeWithAppsFlyerInstallData: nil];\\n}\\n\\n\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func onConversionDataReceived(installData: [NSObject : AnyObject]?) {\\n\\tstartElasticodeWithAppsFlyerInstallData(installData)\\n}\\n\\nfunc onConversionDataRequestFailure(error: NSError) {\\n\\tstartElasticodeWithAppsFlyerInstallData(nil)\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nMore AppsFlyer documentation can be found [here](https://support.appsflyer.com/entries/69796693-Accessing-AppsFlyer-Attribution-Conversion-Data-from-the-SDK-Deferred-Deep-linking-).\n\n\n\n[block:api-header]\n{\n  \"type\": \"basic\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/8H5R9vbVQtOQ2rGUG4pu_br.png\",\n        \"br.png\",\n        \"194\",\n        \"57\",\n        \"#5392ab\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nEasily integrate your **branch.io** account to personalize based on the download-source, by doing the following:\n\nYou can create this helper method:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"-(void) startElasticodeWithBranchIOParams:(NSDictionary*) branchIOParams{\\n\\t[ElastiCode setAPIKey:@\\\"<APIKey>\\\"]; \\n  ECSessionParams* params = [ECSessionParams createInProduction:NO];  \\t\\t \\n  if(branchIOParams){\\n  \\t[params.data addSessionBranchIOAttributes:branchIOParams];\\n  }\\n  [ElastiCode setSessionParams:params];\\n  [EalstiCode ready];\\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func startElasticodeWithBranchIOParams(branchIOParams: [NSObject : AnyObject]?) {\\n let params:ECSessionParams = \\n\\tElastiCode.setAPIKey(\\\"<APIKey>\\\")\\n  let params:ECSessionParams = ECSessionParams .createInProduction(false)\\n\\tif let p = branchIOParams {\\n  \\tparams.data .addSessionBranchIOAttributes(p)\\n  }\\n\\tElastiCode.setSessionParams(params)\\n\\tElastiCode.ready()\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nAnd just add the branch.io methods to your `appDelegate`, `didFinishLaunchingWithOptions` method:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[[Branch getInstance] initSessionWithLaunchOptions:launchOptions \\n \\t\\t\\t    andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {\\n  if (!error) {\\n    [self startElasticodeWithBranchIOParams:params];\\n  }else{\\n    [self startElasticodeWithBranchIOParams:nil];\\n  }\\n}];\\n\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"let branch: Branch = Branch.getInstance()\\n    branch.initSessionWithLaunchOptions(launchOptions, true, andRegisterDeepLinkHandler: { params, error in\\n        if (params) {\\n\\t\\t\\t\\t\\tstartElasticodeWithBranchIOParams(params)\\n        } else {\\n\\t\\t\\t\\t\\tstartElasticodeWithBranchIOParams(nil)\\n        }\\n    })\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nMore Branch.io documentation can be found [here](https://dev.branch.io/).\n\n\n\n[block:api-header]\n{\n  \"type\": \"basic\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/q2P2HDt2Qoe9mG5FRfU7_button.png\",\n        \"button.png\",\n        \"194\",\n        \"57\",\n        \"#60a1d9\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nEasily integrate your **button** account to personalize based on the download-source, by doing the following:\n\nYou can create this helper method:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"-(void) startElasticodeWithButtonParams:(NSDictionary*) buttonParams{\\n\\t[ElastiCode setAPIKey:@\\\"<APIKey>\\\"]; \\n  ECSessionParams* params = [ECSessionParams createInProduction:NO];  \\n  if(buttonParams){\\n  \\t[params.data addSessionButtonAttributes:buttonParams];\\n  }\\n  [ElastiCode setSessionParams:params];\\n  [EalstiCode ready];\\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func startElasticodeWithButtonParams(buttonParams: [NSObject : AnyObject]?) {\\n\\tElastiCode.setAPIKey(\\\"<APIKey>\\\")\\n  let params:ECSessionParams = ECSessionParams .createInProduction(false)\\n\\tif let p = buttonParams {\\n  \\tparams.data .addSessionButtonAttributes(p)\\n  }\\n\\tElastiCode.setSessionParams(params)\\n\\tElastiCode.ready()\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nWhen you register to the route handler pass the parameters to elasticode and start the session:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// For example:\\nself.router[@\\\"/log/:message\\\"] = ^(DPLDeepLink *link) {\\n  [self startElasticodeWithButtonParams:link.routeParameters];\\n};\\n\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"// For example:\\npublic class DPLMessageRouteHandler: DPLRouteHandler {\\n    public override func shouldHandleDeepLink(deepLink: DPLDeepLink!) -> Bool {\\n    \\tif let deepLinkParams = deepLink.routeParameters {\\n      \\tstartElasticodeWithButtonParams(deepLinkParams)\\n      }\\n      return false\\n    }\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nMore Button documentation can be found [here](https://www.usebutton.com/developers/deep-links/).\n\n\n\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/Yx906zXITWgqD1OM6wTA_logo-adjust@2x.png\",\n        \"logo-adjust@2x.png\",\n        \"342\",\n        \"112\",\n        \"#1cbcd4\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nEasily integrate your **adjust** account to personalize based on the download-source, by doing the following:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"-(void) startElasticodeWithAdjustParams:(NSDictionary*) adjustParams{\\n\\t[ElastiCode setAPIKey:@\\\"<APIKey>\\\"]; \\n  ECSessionParams* params = [ECSessionParams createInProduction:NO];  \\n  if(adjustParams){\\n  \\t[params.data addSessionAdjustAttributes:adjustParams];\\n  }\\n  [ElastiCode setSessionParams:params];\\n  [EalstiCode ready];\\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func startElasticodeWithAdjustParams(adjustParams: [NSObject : AnyObject]?) {\\n\\tElastiCode.setAPIKey(\\\"<APIKey>\\\")\\n  let params:ECSessionParams = ECSessionParams .createInProduction(false)\\n\\tif let p = adjustParams {\\n  \\tparams.data .addSessionAdjustAttributes(p)\\n  }\\n\\tElastiCode.setSessionParams(params)\\n\\tElastiCode.ready()\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nIn the delegate callback implementation pass the parameters to elasticode and start the session:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// For example:  \\n  - (void)adjustAttributionChanged:(ADJAttribution *)attribution {\\n  [self startElasticodeWithAdjustParams:[attribuition dictionary]];\\n}\",\n      \"language\": \"objectivec\"\n    },\n    {\n      \"code\": \"func adjustAttributionChanged(attribution: ADJAttribution) {\\n\\tstartElasticodeWithAdjustParams(attribution.dictionary())\\n}\",\n      \"language\": \"swift\"\n    }\n  ]\n}\n[/block]\nMore Adjust documentation can be found [here](https://github.com/adjust/ios_sdk#9-implement-the-attribution-callback).","excerpt":"","slug":"source-attr","type":"basic","title":"Source Attribution"}

Source Attribution


[block:image] { "images": [ { "image": [ "https://files.readme.io/tdcKFmgoTwmkNLcFXbH2_logo.png", "logo.png", "194", "57", "#0493cc", "" ] } ] } [/block] Easily integrate your **AppsFlyer** account to personalize based on the download-source, by doing the following: You can create this helper method: [block:code] { "codes": [ { "code": "-(void) startElasticodeWithAppsFlyerInstallData:(NSDictionary*) installData{\n\t[ElastiCode setAPIKey:@\"<APIKey>\"]; \n ECSessionParams* params = [ECSessionParams createInProduction:NO];\n if(installData){\n \t[params.data addSessionAppsFlyerAttributes:installData];\n }\n [ElastiCode setSessionParams:params];\n [EalstiCode ready];\n}", "language": "objectivec" }, { "code": "func startElasticodeWithAppsFlyerInstallData(installData: [NSObject : AnyObject]?) {\n\tElastiCode.setAPIKey(\"<APIKey>\")\n let params:ECSessionParams = ECSessionParams .createInProduction(false)\n \tif let p = installData {\n \tparams.data .addSessionAppsFlyerAttributes(p)\n }\n\tElastiCode.setSessionParams(params)\n\tElastiCode.ready()\n}", "language": "swift" } ] } [/block] Simply add the AppsFlyer methods to your `appDelegate` like so: [block:code] { "codes": [ { "code": "-(void)onConversionDataReceived:(NSDictionary*) installData {\n\t[self startElasticodeWithAppsFlyerInstallData: installData];\n}\n\n-(void)onConversionDataRequestFailure:(NSError *) error {\n\t[self startElasticodeWithAppsFlyerInstallData: nil];\n}\n\n", "language": "objectivec" }, { "code": "func onConversionDataReceived(installData: [NSObject : AnyObject]?) {\n\tstartElasticodeWithAppsFlyerInstallData(installData)\n}\n\nfunc onConversionDataRequestFailure(error: NSError) {\n\tstartElasticodeWithAppsFlyerInstallData(nil)\n}", "language": "swift" } ] } [/block] More AppsFlyer documentation can be found [here](https://support.appsflyer.com/entries/69796693-Accessing-AppsFlyer-Attribution-Conversion-Data-from-the-SDK-Deferred-Deep-linking-). [block:api-header] { "type": "basic" } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/8H5R9vbVQtOQ2rGUG4pu_br.png", "br.png", "194", "57", "#5392ab", "" ] } ] } [/block] Easily integrate your **branch.io** account to personalize based on the download-source, by doing the following: You can create this helper method: [block:code] { "codes": [ { "code": "-(void) startElasticodeWithBranchIOParams:(NSDictionary*) branchIOParams{\n\t[ElastiCode setAPIKey:@\"<APIKey>\"]; \n ECSessionParams* params = [ECSessionParams createInProduction:NO]; \t\t \n if(branchIOParams){\n \t[params.data addSessionBranchIOAttributes:branchIOParams];\n }\n [ElastiCode setSessionParams:params];\n [EalstiCode ready];\n}", "language": "objectivec" }, { "code": "func startElasticodeWithBranchIOParams(branchIOParams: [NSObject : AnyObject]?) {\n let params:ECSessionParams = \n\tElastiCode.setAPIKey(\"<APIKey>\")\n let params:ECSessionParams = ECSessionParams .createInProduction(false)\n\tif let p = branchIOParams {\n \tparams.data .addSessionBranchIOAttributes(p)\n }\n\tElastiCode.setSessionParams(params)\n\tElastiCode.ready()\n}", "language": "swift" } ] } [/block] And just add the branch.io methods to your `appDelegate`, `didFinishLaunchingWithOptions` method: [block:code] { "codes": [ { "code": "[[Branch getInstance] initSessionWithLaunchOptions:launchOptions \n \t\t\t andRegisterDeepLinkHandler:^(NSDictionary *params, NSError *error) {\n if (!error) {\n [self startElasticodeWithBranchIOParams:params];\n }else{\n [self startElasticodeWithBranchIOParams:nil];\n }\n}];\n", "language": "objectivec" }, { "code": "let branch: Branch = Branch.getInstance()\n branch.initSessionWithLaunchOptions(launchOptions, true, andRegisterDeepLinkHandler: { params, error in\n if (params) {\n\t\t\t\t\tstartElasticodeWithBranchIOParams(params)\n } else {\n\t\t\t\t\tstartElasticodeWithBranchIOParams(nil)\n }\n })", "language": "swift" } ] } [/block] More Branch.io documentation can be found [here](https://dev.branch.io/). [block:api-header] { "type": "basic" } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/q2P2HDt2Qoe9mG5FRfU7_button.png", "button.png", "194", "57", "#60a1d9", "" ] } ] } [/block] Easily integrate your **button** account to personalize based on the download-source, by doing the following: You can create this helper method: [block:code] { "codes": [ { "code": "-(void) startElasticodeWithButtonParams:(NSDictionary*) buttonParams{\n\t[ElastiCode setAPIKey:@\"<APIKey>\"]; \n ECSessionParams* params = [ECSessionParams createInProduction:NO]; \n if(buttonParams){\n \t[params.data addSessionButtonAttributes:buttonParams];\n }\n [ElastiCode setSessionParams:params];\n [EalstiCode ready];\n}", "language": "objectivec" }, { "code": "func startElasticodeWithButtonParams(buttonParams: [NSObject : AnyObject]?) {\n\tElastiCode.setAPIKey(\"<APIKey>\")\n let params:ECSessionParams = ECSessionParams .createInProduction(false)\n\tif let p = buttonParams {\n \tparams.data .addSessionButtonAttributes(p)\n }\n\tElastiCode.setSessionParams(params)\n\tElastiCode.ready()\n}", "language": "swift" } ] } [/block] When you register to the route handler pass the parameters to elasticode and start the session: [block:code] { "codes": [ { "code": "// For example:\nself.router[@\"/log/:message\"] = ^(DPLDeepLink *link) {\n [self startElasticodeWithButtonParams:link.routeParameters];\n};\n", "language": "objectivec" }, { "code": "// For example:\npublic class DPLMessageRouteHandler: DPLRouteHandler {\n public override func shouldHandleDeepLink(deepLink: DPLDeepLink!) -> Bool {\n \tif let deepLinkParams = deepLink.routeParameters {\n \tstartElasticodeWithButtonParams(deepLinkParams)\n }\n return false\n }\n}", "language": "swift" } ] } [/block] More Button documentation can be found [here](https://www.usebutton.com/developers/deep-links/). [block:image] { "images": [ { "image": [ "https://files.readme.io/Yx906zXITWgqD1OM6wTA_logo-adjust@2x.png", "logo-adjust@2x.png", "342", "112", "#1cbcd4", "" ] } ] } [/block] Easily integrate your **adjust** account to personalize based on the download-source, by doing the following: [block:code] { "codes": [ { "code": "-(void) startElasticodeWithAdjustParams:(NSDictionary*) adjustParams{\n\t[ElastiCode setAPIKey:@\"<APIKey>\"]; \n ECSessionParams* params = [ECSessionParams createInProduction:NO]; \n if(adjustParams){\n \t[params.data addSessionAdjustAttributes:adjustParams];\n }\n [ElastiCode setSessionParams:params];\n [EalstiCode ready];\n}", "language": "objectivec" }, { "code": "func startElasticodeWithAdjustParams(adjustParams: [NSObject : AnyObject]?) {\n\tElastiCode.setAPIKey(\"<APIKey>\")\n let params:ECSessionParams = ECSessionParams .createInProduction(false)\n\tif let p = adjustParams {\n \tparams.data .addSessionAdjustAttributes(p)\n }\n\tElastiCode.setSessionParams(params)\n\tElastiCode.ready()\n}", "language": "swift" } ] } [/block] In the delegate callback implementation pass the parameters to elasticode and start the session: [block:code] { "codes": [ { "code": "// For example: \n - (void)adjustAttributionChanged:(ADJAttribution *)attribution {\n [self startElasticodeWithAdjustParams:[attribuition dictionary]];\n}", "language": "objectivec" }, { "code": "func adjustAttributionChanged(attribution: ADJAttribution) {\n\tstartElasticodeWithAdjustParams(attribution.dictionary())\n}", "language": "swift" } ] } [/block] More Adjust documentation can be found [here](https://github.com/adjust/ios_sdk#9-implement-the-attribution-callback).