Skip to content

Commit

Permalink
Remove JS-based event-source registration (#24)
Browse files Browse the repository at this point in the history
The window.attributionReporting.registerSource JS API is being replaced
with a more general mechanism.

WICG/attribution-reporting-api#378 (comment)
  • Loading branch information
apasel422 authored May 24, 2022
1 parent 98d0f8c commit 37d2645
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 46 deletions.
16 changes: 1 addition & 15 deletions conversion-measurement/functions/apps/adtech.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,13 @@ adtech.get('/ad-view-img', (req, res) => {
})
})

adtech.get('/ad-view-js', (req, res) => {
const href = `${process.env.ADVERTISER_URL}`
res.render('ad-view-js', {
attributionsrc: `${adtechUrl}/register-source`
})
})

adtech.get('/ad-script-view-img', (req, res) => {
res.set('Content-Type', 'text/javascript')
const adUrl = `${process.env.ADTECH_URL}/ad-view-img`
const iframe = `<iframe src='${adUrl}' allow='attribution-reporting' width=190 height=190 scrolling=no frameborder=1 padding=0></iframe>`
res.send(`document.write("${iframe}");`)
})

adtech.get('/ad-script-view-js', (req, res) => {
res.set('Content-Type', 'text/javascript')
const adUrl = `${process.env.ADTECH_URL}/ad-view-js`
const iframe = `<iframe src='${adUrl}' allow='attribution-reporting' width=190 height=190 scrolling=no frameborder=1 padding=0></iframe>`
res.send(`document.write("${iframe}");`)
})

adtech.get('/ad-script-click-element', (req, res) => {
res.set('Content-Type', 'text/javascript')
const adClickUrl = `${process.env.ADTECH_URL}/ad-click`
Expand Down Expand Up @@ -326,4 +312,4 @@ adtech.post(
}
)

exports.adtech = functions.https.onRequest(adtech);
exports.adtech = functions.https.onRequest(adtech);
13 changes: 1 addition & 12 deletions conversion-measurement/functions/apps/publisher.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,4 @@ publisher.get('/view-element-img', (req, res) => {
})
})

publisher.get('/view-js', (req, res) => {
const adScriptUrl = `${process.env.ADTECH_URL}/ad-script-view-js`
res.render('article', {
adScriptUrl,
demoHomeUrl,
publisherUrl,
advertiserUrl,
adtechUrl
})
})

exports.publisher = functions.https.onRequest(publisher);
exports.publisher = functions.https.onRequest(publisher);
16 changes: 0 additions & 16 deletions conversion-measurement/functions/views/adtech/ad-view-js.pug

This file was deleted.

4 changes: 1 addition & 3 deletions conversion-measurement/functions/views/publisher/_layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ html
|<br><br>with an
a(href='/view-element-img') HTML element
code img
|<br>with
a(href='/view-js') JS
div
a(href='/') No ad
div.main.mainContentWrapper
Expand All @@ -53,4 +51,4 @@ html
a(href="https://goo.gle/sppi-devrel-eventlevel" target="_blank") Deployed demo
| ・
a(href="https://github.com/GoogleChromeLabs/trust-safety-demo/tree/main/conversion-measurement" target="_blank") Code
script(type="text/javascript" src="/script.js")
script(type="text/javascript" src="/script.js")

0 comments on commit 37d2645

Please sign in to comment.