-
Notifications
You must be signed in to change notification settings - Fork 2.4k
IntentIq ID Module & Analytical Adapter: increase default server call time, support region, bugfixes #14374
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
IntentIq ID Module & Analytical Adapter: increase default server call time, support region, bugfixes #14374
Changes from all commits
f40f920
3bcbb7e
3af02c7
d26ad7f
e408f70
7594f24
9083237
fea590e
16395b6
d2e0ebb
2bea925
dec84b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| export function getUnitPosition(pbjs, adUnitCode) { | ||
| const adUnits = pbjs?.adUnits; | ||
| if (!Array.isArray(adUnits) || !adUnitCode) return; | ||
|
|
||
| for (let i = 0; i < adUnits.length; i++) { | ||
| const adUnit = adUnits[i]; | ||
| if (adUnit?.code !== adUnitCode) continue; | ||
|
|
||
| const mediaTypes = adUnit?.mediaTypes; | ||
| if (!mediaTypes || typeof mediaTypes !== 'object') return; | ||
|
|
||
| const firstKey = Object.keys(mediaTypes)[0]; | ||
| const pos = mediaTypes[firstKey]?.pos; | ||
|
|
||
| return typeof pos === 'number' ? pos : undefined; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,33 @@ | ||
| export const iiqServerAddress = (configParams, gdprDetected) => typeof configParams?.iiqServerAddress === 'string' ? configParams.iiqServerAddress : gdprDetected ? 'https://api-gdpr.intentiq.com' : 'https://api.intentiq.com' | ||
| export const iiqPixelServerAddress = (configParams, gdprDetected) => typeof configParams?.iiqPixelServerAddress === 'string' ? configParams.iiqPixelServerAddress : gdprDetected ? 'https://sync-gdpr.intentiq.com' : 'https://sync.intentiq.com' | ||
| export const reportingServerAddress = (reportEndpoint, gdprDetected) => reportEndpoint && typeof reportEndpoint === 'string' ? reportEndpoint : gdprDetected ? 'https://reports-gdpr.intentiq.com/report' : 'https://reports.intentiq.com/report' | ||
| const REGION_MAPPING = { | ||
| gdpr: true, | ||
| apac: true, | ||
| emea: true | ||
| }; | ||
|
|
||
| function checkRegion(region) { | ||
| if (typeof region !== 'string') return ''; | ||
| const lower = region.toLowerCase(); | ||
| return REGION_MAPPING[lower] ? lower : ''; | ||
| } | ||
|
|
||
| function buildServerAddress(baseName, region) { | ||
| const checkedRegion = checkRegion(region); | ||
| if (checkedRegion) return `https://${baseName}-${checkedRegion}.intentiq.com`; | ||
| return `https://${baseName}.intentiq.com`; | ||
| } | ||
|
|
||
| export const getIiqServerAddress = (configParams = {}) => { | ||
| if (typeof configParams?.iiqServerAddress === 'string') return configParams.iiqServerAddress; | ||
| return buildServerAddress('api', configParams.region); | ||
|
Comment on lines
+19
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This helper now builds API/reporting/sync base URLs solely from Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In our system, each partner account is provisioned for a specific region, and traffic should use the matching regional account. So region routing is intentional and explicit — the account must match the target region. |
||
| }; | ||
|
|
||
| export const iiqPixelServerAddress = (configParams = {}) => { | ||
| if (typeof configParams?.iiqPixelServerAddress === 'string') return configParams.iiqPixelServerAddress; | ||
| return buildServerAddress('sync', configParams.region); | ||
| }; | ||
|
|
||
| export const reportingServerAddress = (reportEndpoint, region) => { | ||
| if (reportEndpoint && typeof reportEndpoint === 'string') return reportEndpoint; | ||
| const host = buildServerAddress('reports', region); | ||
| return `${host}/report`; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| export function appendSPData (url, firstPartyData) { | ||
| const spdParam = firstPartyData?.spd ? encodeURIComponent(typeof firstPartyData.spd === 'object' ? JSON.stringify(firstPartyData.spd) : firstPartyData.spd) : ''; | ||
| url += spdParam ? '&spd=' + spdParam : ''; | ||
| return url | ||
| export function appendSPData (url, partnerData) { | ||
| const spdParam = partnerData?.spd ? encodeURIComponent(typeof partnerData.spd === 'object' ? JSON.stringify(partnerData.spd) : partnerData.spd) : ''; | ||
| if (!spdParam) { | ||
| return url; | ||
| } | ||
| return `${url}&spd=${spdParam}`; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This picks the first key in
adUnit.mediaTypesto readpos. For multi-format adUnits (e.g., banner + video), object key order is not guaranteed to match the winningmediaType, so a video win can be reported with the banner pos (or undefined), corrupting analytics. Consider selectingmediaTypes[data.mediaType]?.pos(or mapping fromadType) when the event includes a media type.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
posis defined at the adUnit level and is identical across mediaTypes, so reading it from any mediaTypes entry yields the same value. We don’t depend on key order for correctness in this case.