Skip to content

Commit 14152b2

Browse files
committed
Enhance NitroAds integration by ensuring hashed email is only sent over HTTPS for better ad targeting
1 parent 8473771 commit 14152b2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

components/home.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,10 @@ export default function Home({ }) {
238238
}
239239
}, [JSON.stringify(mainSession), inCrazyGames])
240240

241-
// Pass hashed email to NitroAds for better ad targeting (logged-in users only)
241+
// Pass hashed email (anonymous) to NitroAds for better ad targeting (logged-in users only, HTTPS only)
242242
useEffect(() => {
243243
const email = session?.token?.email;
244-
if (!email || typeof window === 'undefined' || !window.nitroAds) return;
244+
if (!email || typeof window === 'undefined' || !window.nitroAds || window.location.protocol !== 'https:') return;
245245

246246
(async () => {
247247
try {
@@ -250,7 +250,6 @@ export default function Home({ }) {
250250
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
251251
const hashArray = Array.from(new Uint8Array(hashBuffer));
252252
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
253-
console.log("NitroAds ID", hashHex)
254253
window.nitroAds.addUserToken(hashHex, 'SHA-256');
255254
} catch (e) {
256255
// Silently fail - ad targeting is non-critical

0 commit comments

Comments
 (0)