66 < link rel ="stylesheet " type ="text/css " href ="/stylesheets/app.css " />
77 < link rel ="stylesheet " type ="text/css " href ="/stylesheets/style.css " />
88 < link rel ="shortcut icon " href ="/images/favicon.png " />
9+
910 < script src ="https://code.jquery.com/jquery-3.6.0.min.js "> </ script >
1011 < script src ="<%- uidJsSdkUrl %> "> </ script >
1112 < script src ="<%- secureSignalsSdkUrl %> "> </ script >
1213 < script async src ="https://securepubads.g.doubleclick.net/tag/js/gpt.js "> </ script >
13-
14+
1415 < script >
1516 $ ( document ) . ready ( ( ) => {
1617 const sdkName = '<%- uidJsSdkName %>' ;
2526 $ ( "#login_required" ) . html ( sdk . isLoginRequired ( ) ? "yes" : "no" ) ;
2627 $ ( "#identity_state" ) . html ( String ( JSON . stringify ( payload , null , 2 ) ) ) ;
2728
28- // Update Secure Signals values displayed in the GUI
2929 updateSecureSignals ( ) ;
30+ // Secure Signals SDK usually writes to localStorage shortly after it gets the token.
31+ if ( sdk . getAdvertisingToken ( ) ) {
32+ setTimeout ( updateSecureSignals , 1000 ) ;
33+ }
3034
3135 < % if ( isOptout ) { % >
3236 $ ( "#login_form" ) . hide ( ) ;
3539 $ ( "#optout_banner" ) . show ( ) ;
3640 $ ( '#googleAdContainer' ) . hide ( ) ;
3741 < % } else { % >
38- // before token generation, show login form
42+ // before token generation, show login form.
3943 if ( sdk . isLoginRequired ( ) ) {
4044 $ ( "#login_form" ) . show ( ) ;
4145 $ ( "#logout_form" ) . hide ( ) ;
5559
5660 function updateSecureSignals ( ) {
5761 try {
58- // Read from localStorage
5962 const secureSignalsStorageKey = '<%- secureSignalsStorageKey %>' ;
63+
6064 const secureSignalsStorage = localStorage [ secureSignalsStorageKey ] ;
61-
65+ const token = sdk . getAdvertisingToken ( ) ;
66+ // Token valid but Secure Signals not yet written; reload so the SDK gets another chance.
67+ if ( token && ! secureSignalsStorage ) {
68+ location . reload ( ) ;
69+ return ;
70+ }
71+
6272 const secureSignalsStorageJson = secureSignalsStorage && JSON . parse ( secureSignalsStorage ) ;
63-
6473 if ( secureSignalsStorageJson && secureSignalsStorageJson [ 1 ] ) {
6574 $ ( "#secure_signals_loaded" ) . html ( "yes" ) ;
6675 $ ( "#secure_signals_value" ) . html ( JSON . stringify ( secureSignalsStorageJson , null , 2 ) ) ;
8392 $ ( "#logout" ) . click ( ( ) => {
8493 window . googletag . secureSignalProviders . clearAllCache ( ) ;
8594 sdk . disconnect ( ) ;
95+ localStorage . removeItem ( '<%- secureSignalsStorageKey %>' ) ;
8696 window . location . href = '/' ;
8797 } ) ;
88-
8998 $ ( "#try_another" ) . click ( ( ) => {
9099 window . googletag . secureSignalProviders . clearAllCache ( ) ;
91100 sdk . disconnect ( ) ;
101+ localStorage . removeItem ( '<%- secureSignalsStorageKey %>' ) ;
92102 window . location . href = '/' ;
93103 } ) ;
94104
95- sdk . callbacks . push ( ( eventType , payload ) => {
105+ sdk . callbacks . push ( ( eventType , payload ) => {
96106 if ( eventType === "SdkLoaded" ) {
97107 sdk . init ( {
98108 baseUrl : "<%- uidBaseUrl %>" ,
160170
161171 <!-- UID2 Integration Status Section -->
162172 < h2 > < %- identityName %> Integration Status</ h2 >
173+ < p class ="section-summary "> < strong > Note:</ strong > This is a test-only integration environment—it does not collect data or generate production-level tokens.</ p >
163174
164175 < table id ="uid_state ">
165176 < tr >
@@ -237,7 +248,7 @@ <h2 class="section-teal">Google Secure Signals Status</h2>
237248 </ div >
238249 </ div >
239250 </ td >
240- < td class ="value "> < pre id ="secure_signals_loaded "> </ pre > </ td >
251+ < td class ="value "> < pre id ="secure_signals_loaded "> no </ pre > </ td >
241252 </ tr >
242253 < tr >
243254 < td class ="label ">
@@ -251,7 +262,7 @@ <h2 class="section-teal">Google Secure Signals Status</h2>
251262 </ div >
252263 </ div >
253264 </ td >
254- < td class ="value "> < pre id ="secure_signals_value "> </ pre > </ td >
265+ < td class ="value "> < pre id ="secure_signals_value "> undefined </ pre > </ td >
255266 </ tr >
256267 </ table >
257268
0 commit comments