Skip to content

Commit 4a5998a

Browse files
update and standardize opt out testing steps based off integration
1 parent 7c31d1d commit 4a5998a

File tree

6 files changed

+65
-53
lines changed

6 files changed

+65
-53
lines changed

web-integrations/google-secure-signals/client-side/html/index.html

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ <h2>${IDENTITY_NAME} Integration Status</h2>
6565
</td>
6666
<td class="value"><pre id="login_required"></pre></td>
6767
</tr>
68+
<tr>
69+
<td class="label">
70+
<div class="tooltip-wrapper">
71+
Has Opted Out?
72+
<div class="tooltip">
73+
<span class="tooltip-trigger">?</span>
74+
<div class="tooltip-content">
75+
Shows whether the user has exercised opt-out, in which case no advertising token may be generated or used.
76+
</div>
77+
</div>
78+
</div>
79+
</td>
80+
<td class="value"><pre id="has_opted_out"></pre></td>
81+
</tr>
6882
<tr>
6983
<td class="label">
7084
<div class="tooltip-wrapper">
@@ -120,12 +134,6 @@ <h2>${IDENTITY_NAME} Integration Status</h2>
120134
<button id="play-button">Play</button>
121135
</div>
122136

123-
<div id="optout_banner" style="display: none">
124-
<p>The email address you entered has opted out of ${IDENTITY_NAME}.</p>
125-
</div>
126-
<div id="optout_message" style="display: none" class="form">
127-
<button type="button" class="button" id="try_another">Try Another Email</button>
128-
</div>
129137
<div id="login_form" style="display: none" class="form">
130138
<div class="email_prompt">
131139
<input
@@ -176,16 +184,17 @@ <h4>Step 3: View Video Ad</h4>
176184
<div class="section">
177185
<h4>Step 4: Test Opt-Out</h4>
178186
<ul>
179-
<li>Try entering: <strong>optout@example.com</strong></li>
180-
<li>Yellow banner shows "opted out" status</li>
181-
<li>Click "Try Another Email" to test a different email</li>
187+
<li>Try the special email: <code>test@example.com</code></li>
188+
<li>Observe "Has opted out?" changes to "yes"</li>
189+
<li>No advertising token is generated</li>
182190
</ul>
183191
</div>
184192

185193
<div class="section">
186194
<h4>What's Happening?</h4>
187195
<ul>
188196
<li><strong>Client-Side Token Generation:</strong> The SDK generates tokens directly in the browser</li>
197+
<li><strong>Auto-Refresh:</strong> Tokens are automatically refreshed by the SDK in the background when expired</li>
189198
<li><strong>Google Secure Signals:</strong> Encrypted tokens are stored and shared with Google Ad Manager</li>
190199
<li><strong>IMA SDK:</strong> Displays video ads with ${IDENTITY_NAME} targeting</li>
191200
</ul>

web-integrations/google-secure-signals/client-side/html/scripts/scripts.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,17 @@ function updateGuiElements(state) {
2323

2424
// Check for opt-out: only if user attempted login, and we got identity null with no token
2525
const isOptedOut = loginAttempted && !token && state?.identity === null;
26+
$('#has_opted_out').text(isOptedOut ? 'yes' : 'no');
2627

2728
if (isOptedOut) {
2829
$('#login_form').hide();
29-
$('#logout_form').hide();
30-
$('#optout_message').show();
31-
$('#optout_banner').show();
30+
$('#logout_form').show();
3231
} else if (loginRequired) {
3332
$('#login_form').show();
3433
$('#logout_form').hide();
35-
$('#optout_message').hide();
36-
$('#optout_banner').hide();
3734
} else {
3835
$('#login_form').hide();
3936
$('#logout_form').show();
40-
$('#optout_message').hide();
41-
$('#optout_banner').hide();
4237
}
4338

4439
const secureSignalsStorageKey = '${UID_SECURE_SIGNALS_STORAGE_KEY}';
@@ -81,13 +76,6 @@ function onDocumentReady() {
8176
console.error('setIdentityFromEmail failed', e);
8277
}
8378
});
84-
85-
$('#try_another').click(() => {
86-
window.googletag.secureSignalProviders.clearAllCache();
87-
sdk.disconnect();
88-
$('#email').val('');
89-
loginAttempted = false; // Reset flag
90-
});
9179
}
9280

9381
sdk.callbacks.push(onIdentityUpdated);
@@ -106,8 +94,6 @@ sdk.callbacks.push((eventType, payload) => {
10694
// Set initial UI state - updateGuiElements will adjust based on actual identity state
10795
$('#login_form').show();
10896
$('#logout_form').hide();
109-
$('#optout_message').hide();
110-
$('#optout_banner').hide();
11197
});
11298
}
11399
});

web-integrations/google-secure-signals/client-side/html/styles/app.css

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -244,21 +244,6 @@ a:hover {
244244
}
245245

246246
/* Opt-out Banner */
247-
#optout_banner {
248-
background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 193, 7, 0.05) 100%);
249-
border-left: 4px solid #ffc107;
250-
padding: 1.25rem;
251-
margin: 1.5rem 0;
252-
border-radius: 6px;
253-
color: var(--text-dark);
254-
font-size: 0.95rem;
255-
font-weight: 600;
256-
}
257-
258-
#optout_banner p {
259-
margin: 0;
260-
}
261-
262247
/* Success Message */
263248
.message {
264249
background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);

web-integrations/javascript-sdk/client-side/html/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ <h4>Step 4: Test Opt-Out</h4>
222222
<h4>What's Happening?</h4>
223223
<ul>
224224
<li><strong>Client-Side Token Generation:</strong> The SDK generates tokens directly in the browser using your public credentials</li>
225-
<li><strong>Auto-Refresh:</strong> Tokens are automatically refreshed in the background to maintain up-to-date identity</li>
226-
<li><strong>Local Storage:</strong> Identity is stored in localStorage (__uid2_advertising_token or __euid_advertising_token) for persistence across page loads</li>
225+
<li><strong>Auto-Refresh:</strong> Tokens are automatically refreshed by the SDK in the background when expired</li>
226+
<li><strong>Local Storage:</strong> The SDK stores identity in localStorage (__uid2_advertising_token or __euid_advertising_token) for persistence across page loads</li>
227227
</ul>
228228
</div>
229229

web-integrations/prebid-integrations/client-side/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,6 @@ <h2>${IDENTITY_NAME} Integration Status</h2>
265265
</tr>
266266
</table>
267267

268-
<div id="test-div"></div>
269-
270268
<div id="login_form" style="display: none" class="form">
271269
<div class="email_prompt">
272270
<input
@@ -308,17 +306,19 @@ <h4>Step 2: Observe Integration</h4>
308306
<div class="section">
309307
<h4>Step 3: Test Opt-Out</h4>
310308
<ul>
311-
<li>Try entering: <strong>optout@example.com</strong></li>
312-
<li>Table shows "opted out" status</li>
313-
<li>Click "Clear ${IDENTITY_NAME}" to try another email</li>
309+
<li>Try entering: <strong>test@example.com</strong></li>
310+
<li>Advertising token shows "This email has opted out"</li>
311+
<li>No advertising token is stored</li>
314312
</ul>
315313
</div>
316314

317315
<div class="section">
318316
<h4>What's Happening?</h4>
319317
<ul>
320-
<li><strong>Client-Side Token Generation:</strong> The SDK generates tokens directly in the browser</li>
321-
<li><strong>Prebid Storage:</strong> Tokens are stored in localStorage (__uid2_advertising_token or __euid_advertising_token)</li>
318+
<li><strong>Client-Side Token Generation:</strong> The SDK generates the initial ${IDENTITY_NAME} token directly in the browser</li>
319+
<li><strong>Prebid Management:</strong> Prebid's ${IDENTITY_NAME} module reads and manages the token lifecycle</li>
320+
<li><strong>Auto-Refresh:</strong> Tokens are automatically refreshed by Prebid's ${IDENTITY_NAME} module in the background when expired</li>
321+
<li><strong>Local Storage:</strong> Prebid stores tokens in localStorage (__uid2_advertising_token or __euid_advertising_token) for persistence</li>
322322
<li><strong>Header Bidding:</strong> Prebid shares ${IDENTITY_NAME} tokens with bidders automatically</li>
323323
</ul>
324324
</div>

web-integrations/prebid-secure-signals/client-side/index.html

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
$('#login_form').hide();
4444
$('#clear_storage_form').show();
4545
$('#page-content').hide();
46+
$('#verification_instructions').hide();
4647
} else {
4748
// Show "undefined" if no token, otherwise show the token
4849
$('#advertising_token').text(identity ? String(identity.id) : 'undefined');
@@ -82,6 +83,25 @@
8283
}
8384

8485
function updateSecureSignalsStatus() {
86+
// Check if user is opted out first
87+
const storedToken = localStorage.getItem(storageKey);
88+
let isOptedOut = false;
89+
if (storedToken) {
90+
try {
91+
const tokenData = JSON.parse(storedToken);
92+
isOptedOut = tokenData.latestToken === 'optout';
93+
} catch (e) {
94+
// Ignore parse errors
95+
}
96+
}
97+
98+
// If opted out, don't show verification instructions
99+
if (isOptedOut) {
100+
$('#secure_signals_configured').text('no (opted out)');
101+
$('#verification_instructions').hide();
102+
return;
103+
}
104+
85105
// Check if Prebid has the token and encryptedSignalSources is configured
86106
const prebidUserIds = pbjs.getUserIds();
87107
const uidToken = prebidUserIds[userIdName];
@@ -93,7 +113,7 @@
93113
if (uidToken && isConfigured) {
94114
$('#secure_signals_configured').text('yes');
95115

96-
// Set verification instructions
116+
// Set verification instructions - only show if NOT opted out
97117
$('#verification_instructions').html(
98118
`<strong>To verify that encrypted signals are being sent to Google Ad Manager:</strong><br/><br/>` +
99119
`1. Click the Play button on the video ad below<br/>` +
@@ -404,12 +424,24 @@ <h4>Step 3: View Video Ad</h4>
404424
</ul>
405425
</div>
406426

427+
<div class="section">
428+
<h4>Step 4: Test Opt-Out</h4>
429+
<ul>
430+
<li>Try entering: <strong>[email protected]</strong></li>
431+
<li>Advertising token shows "This email has opted out"</li>
432+
<li>No advertising token is stored</li>
433+
</ul>
434+
</div>
435+
407436
<div class="section">
408437
<h4>What's Happening?</h4>
409438
<ul>
410-
<li><strong>Prebid.js</strong> manages ${IDENTITY_NAME} token storage</li>
411-
<li><strong>Google Secure Signals</strong> shares tokens with bidders</li>
412-
<li><strong>IMA SDK</strong> displays video ads with targeting</li>
439+
<li><strong>Client-Side Token Generation:</strong> The SDK generates the initial ${IDENTITY_NAME} token directly in the browser</li>
440+
<li><strong>Prebid Management:</strong> Prebid's ${IDENTITY_NAME} module reads and manages the token lifecycle</li>
441+
<li><strong>Auto-Refresh:</strong> Tokens are automatically refreshed by Prebid's ${IDENTITY_NAME} module in the background when expired</li>
442+
<li><strong>Local Storage:</strong> Prebid stores tokens in localStorage (__uid2_advertising_token or __euid_advertising_token) for persistence</li>
443+
<li><strong>Google Secure Signals:</strong> Encrypted signals are shared with Google Ad Manager</li>
444+
<li><strong>IMA SDK:</strong> Displays video ads with ${IDENTITY_NAME} targeting</li>
413445
</ul>
414446
</div>
415447

0 commit comments

Comments
 (0)