1.登录OpenInstall网站,这里会为你创建一个AppKey,而这个东西在web页面会用到。

OpenInstall实现APP无邀请码推广-LMLPHP

2.在推广页面中加入推广下载。

    <script type="text/javascript">
var data = OpenInstall.parseUrlParams();//openinstall.js中提供的工具函数,解析url中的所有查询参数
new OpenInstall({
appKey: '@(appKey)',
preferWakeup: true,
onready: function () {
var m = this, button = document.getElementById("downloadButton"), downApp = document.getElementsByClassName("downapp");
button.style.visibility = "visible";
button.onclick = function () { check(m); }
for (var i = ; i < downApp.length; i++) {
var btn = downApp[i];
btn.onclick = function () {
check(m);
}
}
}
}, data); function check(obj) {
var ua = navigator.userAgent.toLowerCase(),
iphoneos = (ua.match(/iphone os/i) == "iphone os") || (ua.match(/iph os/i) == "iph os") || (ua.match(/ipad/i) == "ipad");
var guid = document.querySelector('.guid');
if (iphoneos) {
location.href = "/Home/IOSDownLoad";
}
else {
/*在app已安装的情况尝试拉起app*/
obj.schemeWakeup();
/*用户点击某个按钮时(假定按钮id为downloadButton),安装app*/
obj.wakeupOrInstall();
return false;
}
}
</script>

这里的推广页面地址也可以使用短连接实现,请看我的另一篇文章。

https://www.cnblogs.com/nnnnnn/p/10779204.html

05-21 16:01