-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
81 lines (78 loc) · 3.83 KB
/
index.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html>
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-P56738MR');</script>
<!-- End Google Tag Manager -->
<!-- <script>
// load Branch
(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 banner closeBanner closeJourney data deepview deepviewCta first init link logout removeListener setBranchViewData setIdentity track trackCommerceEvent logEvent disableTracking getBrowserFingerprintId crossPlatformIds lastAttributedTouchData setAPIResponseCallback qrCode".split(" "), 0);
// init Branch
branch.init('key_live_alXEebrYD6sXYsXfU8PREhnhzrcWdEN8');
window.onload = function(e){
setTimeout(() => {
closeBranchJourney();
}, 250);
}
</script> -->
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P56738MR"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<h1 id="page1-h1"> Page 1 </h1>
<h2 id="page1-h2"> non-SPA </h2>
<button id="load-spa" type="button" onclick="handleLoadSPAButtonClicked()">Load SPA page</button>
<button id="load-regular" type="button" onclick="window.location.href = 'https://rob-gioia-branch.github.io/page2.html'">Load regular page</button>
<button id="back-button-1" type="button" onclick="handleBackButtonClicked()">Back</button> <!-- hidden if first page -->
<script>
var isSPAPage = false;
// function closeBranchJourney() {
// console.info("[branch.io] closeJourney is called");
// window.branch.closeJourney((err) => {
// if (err) {
// console.error("[branch.io] Fails to close the Journey: ", err);
// }
// else {
// setTimeout(() => {
// // reopen
// console.info("[branch.io] pageview is called");
// window.branch.track("pageview", (err) => {
// if (err) {
// console.error("[branch.io] Fails to show the Journey:", err);
// }
// })
// }, 500)
// }
// });
// }
function handleBackButtonClicked() {
if(isSPAPage) {
isSPAPage = false;
document.getElementById('load-spa').style.visibility= "visible";
document.getElementById('page1-h1').innerHTML = "Page 1";
document.getElementById('page1-h2').innerHTML = "non-SPA";
window.history.replaceState(null, null, "index.html");
//closeBranchJourney();
dataLayer.push({'event': 'TRIGGER_SPA_CODE'});
}
}
function handleLoadSPAButtonClicked() {
if(!isSPAPage) {
isSPAPage = true;
document.getElementById('load-spa').style.visibility= "hidden";
document.getElementById('page1-h1').innerHTML = "Page 1";
document.getElementById('page1-h2').innerHTML = " current: SPA | prior:non-SPA";
window.history.replaceState(null, null, "page1-spa");
//closeBranchJourney();
dataLayer.push({'event': 'TRIGGER_SPA_CODE'});
}
}
</script>
</body>
</html>