Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HADRN-1004 #7

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5c246b3
IQzone Bid Adapter : update user sync domain (#12320)
IQZoneAdx Oct 18, 2024
1fed96d
Sparteo Bid Adapter: Adapt error messages following param deprecation…
tanguylemeur-sparteo Oct 18, 2024
22a169f
Greenbids RTD Module : add flag to disable filtering (#12331)
maelmrgt Oct 18, 2024
b8dcc7c
Improve Digital Bid Adapter: Bid floor is sent in USD when possible (…
lyubomirshishkov Oct 19, 2024
1cdbb9d
LiveIntent User ID Module: Add DEFAULT_DELAY (#12334)
3link Oct 19, 2024
68f879a
sparteoBidAdapter: add adUnitCode (#12305)
tanguylemeur-sparteo Oct 19, 2024
c84b201
Richaudience Bid Adapter : add gvlid to alias (#12330)
muuki88 Oct 19, 2024
f1b4705
tnc Id System : fixes for docs and performance improvements (#12315)
annavane Oct 20, 2024
0960bcb
Ads Interactive Bid Adpter : add gvlid (#12324)
AdsInteractive Oct 21, 2024
49798b7
Viqeo Bid Adapter: Updated endpoint (#12338)
kinoshnik2070 Oct 21, 2024
4b46054
Aniview Bid Adapter: oRTB support; Plain banner support; Refactoring …
s-solodovnikov Oct 21, 2024
1f0dba2
51Degrees RTD submodule: add `crossorigin` attribute to `script` tag …
jwrosewell Oct 21, 2024
18ae4dc
ads_interactiveBidAdapter: fix broken test (#12350)
dgirardi Oct 21, 2024
fa44eac
Criteo bid adapter: write cookie only on TLD+1 (#12323)
dzhang-criteo Oct 22, 2024
c90f9b3
docereeAdManager Bid Adapter : updated bid adapter (#12333)
Doceree-techStack Oct 22, 2024
24306f3
Kimberlite Bidder Adapter: expand auction price & currency macros (#1…
solta-dev Oct 22, 2024
d607364
Core: fix missing BID_WON for some native ad units (#12349)
dgirardi Oct 22, 2024
cce8964
Core: do not send native targeting keys on ortb requests (#12348)
dgirardi Oct 22, 2024
2fb16e2
gptPreAuction: fix missing gpid when using mcmEnabled (#12356)
dgirardi Oct 22, 2024
75f2a1f
Grid bid adapter add ortb2 device (#11786)
jwrosewell Oct 22, 2024
ac44557
IntentIq ID & Analytics Modules : manual reporting, bug fixes, refact…
dLepetynskyiIntentiq Oct 23, 2024
d7c8547
PAAPI: parallel contextual and IG auctions (#12205)
dgirardi Oct 23, 2024
91587a1
Revert "gptPreAuction: fix missing gpid when using mcmEnabled (#12356…
dgirardi Oct 23, 2024
0c310c3
gptPreAuction: fix missing gpid when using mcmEnabled (#12361)
dgirardi Oct 23, 2024
c012232
Paapi: log error instead of warning when auction configs are received…
dgirardi Oct 23, 2024
6fc52d6
Permutive Identity Manager: initial implementation (#12337)
talbotja Oct 24, 2024
8b5d33e
Supporting multi-format ads in prebid (#12265)
antosarho Oct 24, 2024
d4f57ee
bidResponseFilter Module : do not run if not configured (#12362)
dgirardi Oct 24, 2024
51f329e
Contxtful Bid Adapter : initial release (#12256)
sebastienrufiange Oct 24, 2024
34f0a55
Prebid 9.17.0 release
prebidjs-release Oct 24, 2024
aafef47
Increment version to 9.18.0-pre
prebidjs-release Oct 24, 2024
260a1b6
Preciso Bid adapter : Native implemented (#12278)
NikhilGopalChennissery Oct 24, 2024
9073a02
Showheroes Bid Adapter : full rework of the adapter (#12283)
FilipStamenkovic Oct 25, 2024
80fbc98
QortexRtdProvider: Supports new Qortex bid enrichment process (#12173)
shilohannese Oct 25, 2024
6ae5759
Appnexus Bid Adapter: Copy video over to custom native fields so it c…
JaroVDH Oct 25, 2024
1ca84d7
Add sizes... again... (#12371)
robertrmartinez Oct 25, 2024
3a2d06e
LiveIntent UserId Module : add support for sharethrough, sonobi, vida…
3link Oct 28, 2024
a1685f3
don't use localStorage for storing and minimize its use for reading
jlaso Jul 26, 2024
e545e7b
don't use localStorage for storing and minimize its use for reading
jlaso Jul 26, 2024
c1e4b33
restoring value of hadronId in storage (doc)
jlaso Aug 5, 2024
d08ec1e
making tests pass
jlaso Oct 29, 2024
961eb59
making test pass
jlaso Oct 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
IntentIq ID & Analytics Modules : manual reporting, bug fixes, refact…
…oring (prebid#12314)

* update intentIqAnalyticsAdapter.js && intentIqIdSystem.js

* fix lint issues

* fix tests

* move info

* resolve issues

* update storeFirstPartyData

* remove unused code

* update defineEmptyDataAndFireCallback

* update fix lint

* update reportExternalWin

* small fixes

* update test && add docs

---------

Co-authored-by: DimaIntentIQ <dmytro.piskun@intentiq.com>
Co-authored-by: DimaIntentIQ <139111483+DimaIntentIQ@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 23, 2024
commit ac44557b92bec43baeb25c529454d9c5f07836a8
10 changes: 10 additions & 0 deletions libraries/intentIqConstants/intentIqConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const FIRST_PARTY_KEY = '_iiq_fdata';

export const WITH_IIQ = 'A';
export const WITHOUT_IIQ = 'B';
export const NOT_YET_DEFINED = 'U';
export const OPT_OUT = 'O';
export const BLACK_LIST = 'L';
export const CLIENT_HINTS_KEY = '_iiq_ch';
export const EMPTY = 'EMPTY'
export const VERSION = 0.21
121 changes: 82 additions & 39 deletions modules/intentIqAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import { logInfo, logError, getWindowSelf, getWindowTop, getWindowLocation } from '../src/utils.js';
import {getWindowLocation, getWindowSelf, getWindowTop, logError, logInfo} from '../src/utils.js';
import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
import { ajax } from '../src/ajax.js';
import { getStorageManager } from '../src/storageManager.js';
import { config } from '../src/config.js';
import { EVENTS } from '../src/constants.js';
import { MODULE_TYPE_ANALYTICS } from '../src/activities/modules.js';
import { detectBrowser } from '../libraries/detectBrowserUtils/detectBrowserUtils.js';
import {ajax} from '../src/ajax.js';
import {getStorageManager} from '../src/storageManager.js';
import {config} from '../src/config.js';
import {EVENTS} from '../src/constants.js';
import {MODULE_TYPE_ANALYTICS} from '../src/activities/modules.js';
import {detectBrowser} from '../libraries/detectBrowserUtils/detectBrowserUtils.js';
import {CLIENT_HINTS_KEY, FIRST_PARTY_KEY, VERSION} from '../libraries/intentIqConstants/intentIqConstants.js';

const MODULE_NAME = 'iiqAnalytics'
const analyticsType = 'endpoint';
const defaultUrl = 'https://reports.intentiq.com/report';
const storage = getStorageManager({ moduleType: MODULE_TYPE_ANALYTICS, moduleName: MODULE_NAME });
const storage = getStorageManager({moduleType: MODULE_TYPE_ANALYTICS, moduleName: MODULE_NAME});
const prebidVersion = '$prebid.version$';
export const REPORTER_ID = Date.now() + '_' + getRandom(0, 1000);

const FIRST_PARTY_KEY = '_iiq_fdata';
const FIRST_PARTY_DATA_KEY = '_iiq_fdata';
const JSVERSION = 0.2

const PARAMS_NAMES = {
abTestGroup: 'abGroup',
pbPauseUntil: 'pbPauseUntil',
@@ -55,7 +52,7 @@ const PARAMS_NAMES = {
firstPartyId: 'pcid'
};

let iiqAnalyticsAnalyticsAdapter = Object.assign(adapter({ defaultUrl, analyticsType }), {
let iiqAnalyticsAnalyticsAdapter = Object.assign(adapter({defaultUrl, analyticsType}), {
initOptions: {
lsValueInitialized: false,
partner: null,
@@ -64,13 +61,16 @@ let iiqAnalyticsAnalyticsAdapter = Object.assign(adapter({ defaultUrl, analytics
dataInLs: null,
eidl: null,
lsIdsInitialized: false,
manualReport: false
manualWinReportEnabled: false
},
track({ eventType, args }) {
track({eventType, args}) {
switch (eventType) {
case BID_WON:
bidWon(args);
break;
case BID_REQUESTED:
defineGlobalVariableName();
break;
default:
break;
}
@@ -79,7 +79,8 @@ let iiqAnalyticsAnalyticsAdapter = Object.assign(adapter({ defaultUrl, analytics

// Events needed
const {
BID_WON
BID_WON,
BID_REQUESTED
} = EVENTS;

function readData(key) {
@@ -113,6 +114,7 @@ function initLsValues() {
iiqAnalyticsAnalyticsAdapter.initOptions.partner = iiqArr[0].params.partner;
}
iiqAnalyticsAnalyticsAdapter.initOptions.browserBlackList = typeof iiqArr[0].params.browserBlackList === 'string' ? iiqArr[0].params.browserBlackList.toLowerCase() : '';
iiqAnalyticsAnalyticsAdapter.initOptions.manualWinReportEnabled = iiqArr[0].params.manualWinReportEnabled || false
}
}

@@ -123,20 +125,27 @@ function initReadLsIds() {
if (iiqAnalyticsAnalyticsAdapter.initOptions.fpid) {
iiqAnalyticsAnalyticsAdapter.initOptions.currentGroup = iiqAnalyticsAnalyticsAdapter.initOptions.fpid.group;
}
let iData = readData(FIRST_PARTY_DATA_KEY + '_' + iiqAnalyticsAnalyticsAdapter.initOptions.partner);
if (iData) {
const partnerData = readData(FIRST_PARTY_KEY + '_' + iiqAnalyticsAnalyticsAdapter.initOptions.partner);
const clientsHints = readData(CLIENT_HINTS_KEY) || '';

if (partnerData) {
iiqAnalyticsAnalyticsAdapter.initOptions.lsIdsInitialized = true;
let pData = JSON.parse(iData);
let pData = JSON.parse(partnerData);
iiqAnalyticsAnalyticsAdapter.initOptions.terminationCause = pData.terminationCause
iiqAnalyticsAnalyticsAdapter.initOptions.dataInLs = pData.data;
iiqAnalyticsAnalyticsAdapter.initOptions.eidl = pData.eidl || -1;
}

iiqAnalyticsAnalyticsAdapter.initOptions.clientsHints = clientsHints
} catch (e) {
logError(e)
}
}

function bidWon(args) {
if (!iiqAnalyticsAnalyticsAdapter.initOptions.lsValueInitialized) { initLsValues(); }
function bidWon(args, isReportExternal) {
if (!iiqAnalyticsAnalyticsAdapter.initOptions.lsValueInitialized) {
initLsValues();
}

if (isNaN(iiqAnalyticsAnalyticsAdapter.initOptions.partner) || iiqAnalyticsAnalyticsAdapter.initOptions.partner == -1) return;

@@ -146,12 +155,31 @@ function bidWon(args) {
return;
}

if (iiqAnalyticsAnalyticsAdapter.initOptions.lsValueInitialized && !iiqAnalyticsAnalyticsAdapter.initOptions.lsIdsInitialized) { initReadLsIds(); }
if (!iiqAnalyticsAnalyticsAdapter.initOptions.manualReport) {
ajax(constructFullUrl(preparePayload(args, true)), undefined, null, { method: 'GET' });
if (iiqAnalyticsAnalyticsAdapter.initOptions.lsValueInitialized && !iiqAnalyticsAnalyticsAdapter.initOptions.lsIdsInitialized) {
initReadLsIds();
}
if ((isReportExternal && iiqAnalyticsAnalyticsAdapter.initOptions.manualWinReportEnabled) || (!isReportExternal && !iiqAnalyticsAnalyticsAdapter.initOptions.manualWinReportEnabled)) {
ajax(constructFullUrl(preparePayload(args, true)), undefined, null, {method: 'GET'});
logInfo('IIQ ANALYTICS -> BID WON')
return true;
}
return false;
}

function defineGlobalVariableName() {
function reportExternalWin(args) {
return bidWon(args, true)
}

logInfo('IIQ ANALYTICS -> BID WON')
let partnerId = 0
const userConfig = config.getConfig('userSync.userIds')

if (userConfig) {
const iiqArr = userConfig.filter(m => m.name == 'intentIqId');
if (iiqArr.length) partnerId = iiqArr[0].params.partner
}

window[`intentIqAnalyticsAdapter_${partnerId}`] = {reportExternalWin: reportExternalWin}
}

function getRandom(start, end) {
@@ -160,11 +188,11 @@ function getRandom(start, end) {

export function preparePayload(data) {
let result = getDefaultDataObject();

readData(FIRST_PARTY_KEY + '_' + iiqAnalyticsAnalyticsAdapter.initOptions.partner);
result[PARAMS_NAMES.partnerId] = iiqAnalyticsAnalyticsAdapter.initOptions.partner;
result[PARAMS_NAMES.prebidVersion] = prebidVersion;
result[PARAMS_NAMES.referrer] = getReferrer();

result[PARAMS_NAMES.terminationCause] = iiqAnalyticsAnalyticsAdapter.initOptions.terminationCause;
result[PARAMS_NAMES.abTestGroup] = iiqAnalyticsAnalyticsAdapter.initOptions.currentGroup;

result[PARAMS_NAMES.isInTestGroup] = iiqAnalyticsAnalyticsAdapter.initOptions.currentGroup == 'A';
@@ -187,13 +215,27 @@ function fillEidsData(result) {
}

function fillPrebidEventData(eventData, result) {
if (eventData.bidderCode) { result.bidderCode = eventData.bidderCode; }
if (eventData.cpm) { result.cpm = eventData.cpm; }
if (eventData.currency) { result.currency = eventData.currency; }
if (eventData.originalCpm) { result.originalCpm = eventData.originalCpm; }
if (eventData.originalCurrency) { result.originalCurrency = eventData.originalCurrency; }
if (eventData.status) { result.status = eventData.status; }
if (eventData.auctionId) { result.prebidAuctionId = eventData.auctionId; }
if (eventData.bidderCode) {
result.bidderCode = eventData.bidderCode;
}
if (eventData.cpm) {
result.cpm = eventData.cpm;
}
if (eventData.currency) {
result.currency = eventData.currency;
}
if (eventData.originalCpm) {
result.originalCpm = eventData.originalCpm;
}
if (eventData.originalCurrency) {
result.originalCurrency = eventData.originalCurrency;
}
if (eventData.status) {
result.status = eventData.status;
}
if (eventData.auctionId) {
result.prebidAuctionId = eventData.auctionId;
}

result.biddingPlatformId = 1;
result.partnerAuctionId = 'BW';
@@ -206,7 +248,7 @@ function getDefaultDataObject() {
'partnerAuctionId': 'BW',
'reportSource': 'pbjs',
'abGroup': 'U',
'jsversion': JSVERSION,
'jsversion': VERSION,
'partnerId': -1,
'biddingPlatformId': 1,
'idls': false,
@@ -224,18 +266,19 @@ function constructFullUrl(data) {
((iiqAnalyticsAnalyticsAdapter.initOptions && iiqAnalyticsAnalyticsAdapter.initOptions.fpid)
? '&iiqid=' + encodeURIComponent(iiqAnalyticsAnalyticsAdapter.initOptions.fpid.pcid) : '') +
'&agid=' + REPORTER_ID +
'&jsver=' + JSVERSION +
'&jsver=' + VERSION +
'&vrref=' + getReferrer() +
'&source=pbjs' +
'&payload=' + JSON.stringify(report)
'&payload=' + JSON.stringify(report) +
'&uh=' + iiqAnalyticsAnalyticsAdapter.initOptions.clientsHints
}

export function getReferrer() {
try {
if (getWindowSelf() === getWindowTop()) {
return getWindowLocation().href;
return encodeURIComponent(getWindowLocation().href);
} else {
return getWindowTop().location.href;
return encodeURIComponent(getWindowTop().location.href);
}
} catch (error) {
logError(`Error accessing location: ${error}`);
62 changes: 60 additions & 2 deletions modules/intentIqAnalyticsAdapter.md
Original file line number Diff line number Diff line change
@@ -16,12 +16,70 @@ No registration for this module is required.

<B>IMPORTANT</B>: only effective when Intent IQ Universal ID module is installed and configured. [(How-To)](https://docs.prebid.org/dev-docs/modules/userid-submodules/intentiq.html)

No additional configuration for this module is required. We will use the configuration provided for Intent IQ Universal IQ module.

#### Example Configuration

```js
pbjs.enableAnalytics({
provider: 'iiqAnalytics'
});
```


### Manual Report Trigger with reportExternalWin

The reportExternalWin function allows for manual reporting, meaning that reports will not be sent automatically but only when triggered manually.

To enable this manual reporting functionality, you must set the manualWinReportEnabled parameter in Intent IQ Unified ID module configuration is true. Once enabled, reports can be manually triggered using the reportExternalWin function.


### Calling the reportExternalWin Function

To call the reportExternalWin function, you need to pass the partner_id parameter as shown in the example below:

```js
window.intentIqAnalyticsAdapter_[partner_id].reportExternalWin()
```
Example use with Partner ID = 123455

```js
window.intentIqAnalyticsAdapter_123455.reportExternalWin()
```

### Function Parameters

The reportExternalWin function takes an object containing auction win data. Below is an example of the object:

```js
var reportData = {
biddingPlatformId: 1, // Platform ID. The value 1 corresponds to PreBid.
partnerAuctionId: '[YOUR_AUCTION_ID_IF_EXISTS]', // Auction ID, if available.
bidderCode: 'xxxxxxxx', // Bidder code.
prebidAuctionId: '3d4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx8e', // PreBid auction ID.
cpm: 1.5, // Cost per thousand impressions (CPM).
currency: 'USD', // Currency for the CPM value.
originalCpm: 1.5, // Original CPM value.
originalCurrency: 'USD', // Original currency.
status: 'rendered', // Auction status, e.g., 'rendered'.
placementId: 'div-1' // ID of the ad placement.
}
```

| Field | Data Type | Description | Example | Mandatory |
|--------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|-----------|
| biddingPlatformId | Integer | Specify the platform in which this ad impression was rendered – 1 – Prebid, 2 – Amazon, 3 – Google, 4 – Open RTB (including your local Prebid server) | 1 | Yes |
| partnerAuctionId | String | Use this when you are running multiple auction solutions across your assets and have a unified identifier for auctions | 3d44542d-xx-4662-xxxx-4xxxx3d8e | No |
| bidderCode | String | Specifies the name of the bidder that won the auction as reported by Prebid and all other bidding platforms | newAppnexus | Yes |
| prebidAuctionId | String | Specifies the identifier of the Prebid auction. Leave empty or undefined if Prebid is not the bidding platform | | |
| cpm | Decimal | Cost per mille of the impression as received from the demand-side auction (without modifications or reductions) | 5.62 | Yes |
| currency | String | Currency of the auction | USD | Yes |
| originalCpm | Decimal | Leave empty or undefined if Prebid is not the bidding platform | 5.5 | No |
| originalCurrency | String | Currency of the original auction | USD | No |
| status | String | Status of the impression. Leave empty or undefined if Prebid is not the bidding platform | rendered | No |
| placementId | String | Unique identifier of the ad unit on the webpage that showed this ad | div-1 | No |


To report the auction win, call the function as follows:

```js
window.intentIqAnalyticsAdapter_[partner_id].reportExternalWin(reportData)
```
Loading
Oops, something went wrong.