Skip to content

Commit

Permalink
Revert "Adtech data seeding changes (#22)"
Browse files Browse the repository at this point in the history
This reverts commit c2d6c73.
  • Loading branch information
DelphianCalamity committed Oct 8, 2024
1 parent fde1d49 commit 483e3ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 33 deletions.
38 changes: 7 additions & 31 deletions demo/functions/apps/adtech.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,12 @@ adtech.get('/ad-script-click-element', (req, res) => {
/* -------------------------------------------------------------------------- */
/* Source registration (ad click or view) */
/* -------------------------------------------------------------------------- */

adtech.get('/register-source-href', (req, res) => {
const attributionDestination = process.env.ADVERTISER_URL
// For demo purposes, sourceEventId is a random ID. In a real system, this ID would be tied to a unique serving-time identifier mapped to any information an adtech provider may need
const sourceEventId = Math.floor(Math.random() * 1000000000000000)
const legacyMeasurementCookie = req.cookies['__session']
var epoch = 1
if(req.query['epoch'] != undefined)
{
epoch = req.query['epoch']
}

const headerConfig = {
source_event_id: `${sourceEventId}`,
Expand All @@ -141,7 +137,7 @@ adtech.get('/register-source-href', (req, res) => {
expiry: '604800',
// debug_key as legacyMeasurementCookie is a simple approach for demo purposes. In a real system, you may make debug_key a unique ID, and map it to additional source-time information that you deem useful for debugging or performance comparison.
debug_key: legacyMeasurementCookie,
epoch: epoch,
epoch: '4',
filter_data: {
campaignId: ['444']
},
Expand Down Expand Up @@ -172,15 +168,13 @@ adtech.get('/seed-source-registration', (req, res) => {
const attributionDestination = process.env.ADVERTISER_URL
// For demo purposes, sourceEventId is a random ID. In a real system, this ID would be tied to a unique serving-time identifier mapped to any information an adtech provider may need
const sourceEventId = Math.floor(Math.random() * 1000000000000000)
epoch = 2
if(req.query['epoch'] != undefined)
epoch = req.query['epoch']

const headerConfig = {
source_event_id: `${sourceEventId}`,
destination: attributionDestination,
// Optional: expiry of 7 days (default is 30)
expiry: '604800',
epoch: epoch,
epoch: '2',
filter_data: {
campaignId: ['123']
},
Expand Down Expand Up @@ -211,17 +205,6 @@ res.sendStatus(200)
adtech.get('/conversion', (req, res) => {
const productCategory = req.query['product-category']
// const purchaseValue = req.query['purchase-value']
var epcoh_end = 2
var epoch_start = 1
if(req.query['epoch_end'] != undefined)
{
epcoh_end = req.query['epoch_end']
}

if(req.query['epoch_start'] != undefined)
{
epcoh_end = req.query['epoch_start']
}

const filters = {
// Because conversion_product_type has been set to category_1 in the header Attribution-Reporting-Register-Source, any incoming conversion whose productCategory does not match category_1 will be filtered out i.e. will not generate a report.
Expand Down Expand Up @@ -249,8 +232,8 @@ adtech.get('/conversion', (req, res) => {
}


const globalEpsilon = 0.1
const attributionWindow = {epoch_start: epoch_start, epoch_end: epcoh_end}
const globalEpsilon = 0.25
const attributionWindow = {epoch_start: 2, epoch_end: 4}
const attributionLogic = "last_touch"
const partitioningLogic = ""

Expand Down Expand Up @@ -374,14 +357,7 @@ adtech.post(
adtech.get(
'/source-registration-seeder',
async (req, res) => {
var epoch_start = 1
var epoch_end = 1
if(req.query['epoch_start'] != undefined)
epoch_start = req.query['epoch_start']
if(req.query['epoch_end'] != undefined)
epoch_end = req.query['epoch_end']

res.render('source-registration-seeder', {adtechUrl,epoch_start,epoch_end})
res.render('source-registration-seeder', {adtechUrl})
}
)

Expand Down
4 changes: 2 additions & 2 deletions demo/functions/views/adtech/source-registration-seeder.pug
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ body
triggerEligible: false,
};

for (let i = #{epoch_start}; i <= #{epoch_end}; i++) {
await fetch(`#{adtechUrl}/seed-source-registration?epoch=` + i, {
for (let i = 0; i < 10; i++) {
await fetch(`#{adtechUrl}/seed-source-registration`, {
keepalive: true,
attributionReporting,
mode: "no-cors",
Expand Down

0 comments on commit 483e3ff

Please sign in to comment.