-
Notifications
You must be signed in to change notification settings - Fork 1
/
makenewlinktest.html
41 lines (39 loc) · 1.8 KB
/
makenewlinktest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<html>
<head>
<script>
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode autoAppIndex banner closeBanner closeJourney creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setBranchViewData setIdentity track validateCode trackCommerceEvent".split(" "), 0);
// init Branch
branch.init('YOUR_KEY_HERE', function(err, data) {
var linkData = {};
var linkOptions = {
make_new_link: true
};
if (data["data_parsed"]["+clicked_branch_link"]) {
data["data_parsed"]['$ios_url'] = 'https://itunes.apple.com/us/app/earnin-get-paid-today/id723815926?mt=8';
data["data_parsed"]['$android_url'] = 'https://play.google.com/store/apps/details?id=com.activehours&hl=en_US';
linkData = data["data_parsed"];
} else {
linkData = {
campaign: 'content 123',
channel: 'landing',
feature: 'dashboard',
stage: 'new user',
tags: ['tag1', 'tag2', 'tag3'],
// alias: '' -> removed this, as an empty alias will just be ignored by the branch.link call
};
}
branch.link(linkData,
linkOptions,
function (err, link) {
var deepLinks = document.getElementsByClassName("deepLink");
for (var i = 0; i < deepLinks.length; i++) {
deepLinks[i].setAttribute("href", link);
}
});
});
</script>
</head>
<body>
<a href="" class="deepLink">Link 4</a>
</body>
</html>