- Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
127 lines (122 loc) · 4.46 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html>
<head>
<metacharset="UTF-8" />
<title>UID2 Publisher Server-Side Integration Example</title>
<linkrel="stylesheet" type="text/css" href="/stylesheets/app.css" />
<linkrel="stylesheet" type="text/css" href="/stylesheets/style.css" />
<linkrel="shortcut icon" href="/images/favicon.png" />
<scriptsrc="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(()=>{
letcallbackCounter=0;
functionupdateGuiElements(payload){
$("#targeted_advertising_ready").html(
__uid2.getAdvertisingToken() ? "yes" : "no"
);
$("#advertising_token").html(String(__uid2.getAdvertisingToken()));
$("#login_required").html(__uid2.isLoginRequired() ? "yes" : "no");
$("#update_counter").html(callbackCounter);
$("#identity_state").html(String(JSON.stringify(payload,null,2)));
if(__uid2.isLoginRequired()){
$("#login_form").show();
$("#logout_form").hide();
$('#googleAdContainer').hide();
}else{
$("#login_form").hide();
$("#logout_form").show();
$('#googleAdContainer').show();
}
}
functiononUid2IdentityUpdated(eventType,payload){
if(
payload?.identity&&
(eventType==="InitCompleted"||eventType==="IdentityUpdated")
){
++callbackCounter;
}
updateGuiElements(payload);
}
$("#logout").click(()=>{
window.__uid2.disconnect();
window.googletag.secureSignalProviders.clearAllCache();
updateGuiElements(undefined);
});
$("#login").click(()=>{
window.googletag.secureSignalProviders.clearAllCache();
updateGuiElements(undefined);
});
window.__uid2=window.__uid2||{callbacks: []};
window.__uid2.callbacks.push((eventType,payload)=>{
if(eventType==="SdkLoaded"){
__uid2.init({
baseUrl: "<%- uid2BaseUrl %>",
enableSecureSignals: true,
});
}
});
window.__uid2.callbacks.push(onUid2IdentityUpdated);
});
</script>
</head>
<body>
<divid="googleAdContainer" style="display: none">
<divid="mainContainer">
<divid="content">
<videoid="contentElement">
<sourcesrc="https://storage.googleapis.com/gvabox/media/samples/stock.mp4"></source>
</video>
</div>
<divid="adContainer"></div>
</div>
<buttonid="playButton">Play</button>
<scripttype="text/javascript" src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<scriptasyncsrc="https://cdn.integ.uidapi.com/uid2SecureSignal.js"></script>
<scriptasyncsrc="<%- uid2JsSdkUrl %>"></script>
<scriptasyncsrc="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<scripttype="text/javascript" src="ads.js"></script>
</div>
<%- include('intro.html'); -%>
<tableid="uid2_state">
<tr>
<tdclass="label">Ready for Targeted Advertising:</td>
<tdclass="value"><preid="targeted_advertising_ready"></pre></td>
</tr>
<tr>
<tdclass="label">UID2 Advertising Token:</td>
<tdclass="value"><preid="advertising_token"></pre></td>
</tr>
<tr>
<tdclass="label">Is UID2 Login Required?</td>
<tdclass="value"><preid="login_required"></pre></td>
</tr>
<tr>
<tdclass="label">UID2 Identity Updated Counter:</td>
<tdclass="value"><preid="update_counter"></pre></td>
</tr>
<tr>
<tdclass="label">UID2 Identity Callback State:</td>
<tdclass="value"><preid="identity_state"></pre></td>
</tr>
</table>
<divid="login_form" style="display: none" class="form">
<formaction="/login" method="POST">
<divclass="email_prompt">
<input
type="text"
id="email"
name="email"
placeholder="Enter an email address"
style="border-style: none"
/>
</div>
<div><inputtype="submit" value="Log In" class="button" id="login" /></div>
</form>
</div>
<divid="logout_form" style="display: none" class="form">
<form>
<buttontype="button" class="button" id="logout">Log Out</button>
</form>
</div>
</body>
</html>