App推广:openinstall渠道统计从注册到iOS集成

App推广:openinstall渠道统计从注册到iOS集成

openinstall不仅能实现渠道统计,我们还能通过它实现个性化安装,比如:免填邀请码、自动关联好友、自动进入好友游戏房间等等,关于这些就不多说了,这里我们只介绍openinstall渠道统计从注册到iOS集成。

2OpeninstallSDK详细集成

第一步,进入openinstall官网,点击“立即使用”,根据提示注册登录账户。

第二步,登录后,会进入“应用管理”界面,在“应用管理”界面,点击“创建应用”,填写你要集成的应用名称,选择应用分类,点击“创建”,完成应用的创建。

第三步,应用创建完成后会进入“应用配置”界面,这时我们会获得一个我们所创建应用对应的Appkey,在左上角应用图表下面可以查看到。接下来,在右侧配置区选择“IOS配置”标签,点击标签下面的“现在去集成”,进入“iOS集成”文档。

第四步,在“iOS集成”文档界面,点击蓝色“下载iOS SDK”字体下载iOS SDK。下载完成后,将SDK导入工程(直接拖拽SDK文件夹到工程即可)。

第五步,将集成文档中个性化安装部分的代码复制到工程的AppDelegate.m文件中。代码如下(Tip:其中加粗斜体为你创建应用的Appkey,集成文档中已经自动替换,只要复制就行):

-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{

ViewController*vc=[[ViewControlleralloc]init];

self.window.rootViewController=vc;

//初始化OpenInstall

[OpenInstallSDKsetAppKey:@"rjyr3n"withDelegate:self];

[self.windowmakeKeyAndVisible];

returnYES;

}

//通过OpenInstall获取自定义参数。

-(void)getInstallParamsFromOpenInstall:(NSDictionary*)paramswithError:(NSError*)error{

if(!error){

NSLog(@"OpenInstall自定义数据:%@",[paramsdescription]);

if(params){

NSString*paramsStr=[NSStringstringWithFormat:@"%@",params];

UIAlertController*alert=[UIAlertControlleralertControllerWithTitle:@"我是来自那个集成了openinstallJSSDK页面的安装,请根据你的需求,将我计入统计数据或是根据贵公司App的业务流程处理(如免填邀请码建立邀请关系、自动加好友、自动进入某个群组或房间等)"message:paramsStrpreferredStyle:UIAlertControllerStyleAlert];

[alertaddAction:[UIAlertActionactionWithTitle:@"确定"style:UIAlertActionStyleDefaulthandler:^(UIAlertAction*_Nonnullaction){

}]];

//弹出提示框(便于调试,调试完成后删除此代码)

[self.window.rootViewControllerpresentViewController:alertanimated:truecompletion:nil];

//获取到参数后可保存到本地,等到需要使用时再从本地获取。

NSUserDefaults *openinstallData = [NSUserDefaults standardUserDefaults];

[openinstallData setObject:params forKey:@"openinstallParams"];

}

}else{

NSLog(@"OpenInstallerror%@",error);

}

}