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

Feature/intent iq id added #5428

Merged
merged 7 commits into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 12 additions & 1 deletion integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,18 @@
name: "unifiedid",
expires: 30
},
}, {
},{
name: "intentIqId",
params: {
partner: 0, //Set your real IntentIQ partner ID here for production.
},
storage: {
type: "cookie",
name: "intentIqId",
expires: 30
},
},
{
name: "id5Id",
params: {
partner: 173 //Set your real ID5 partner ID here for production, please ask for one at http://id5.io/prebid
Expand Down
68 changes: 68 additions & 0 deletions modules/intentIqIdSystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* This module adds IntentIqId to the User ID module
* The {@link module:modules/userId} module is required
* @module modules/intentIqIdSystem
* @requires module:modules/userId
*/

import * as utils from '../src/utils.js'
import {ajax} from '../src/ajax.js';
import {submodule} from '../src/hook.js'

const MODULE_NAME = 'intentIqId';

/** @type {Submodule} */
export const intentIqIdSubmodule = {
/**
* used to link submodule with config
* @type {string}
*/
name: MODULE_NAME,
/**
* decode the stored id value for passing to bid requests
* @function
* @param {{ctrid:string}} value
* @returns {{intentIqId:string}}
*/
decode(value) {
return (value && typeof value['ctrid'] === 'string') ? { 'intentIqId': value['ctrid'] } : undefined;
},
/**
* performs action to obtain id and return a value in the callback's response argument
* @function
* @param {SubmoduleParams} [configParams]
* @returns {IdResponse|undefined}
*/
getId(configParams) {
if (!configParams || typeof configParams.partner !== 'number') {
utils.logError('User ID - intentIqId submodule requires a valid partner to be defined');
return;
}

// use protocol relative urls for http or https
const url = `https://api.intentiq.com/profiles_engine/ProfilesEngineServlet?at=39&mi=10&dpi=${configParams.partner}&pt=17&dpn=1`;
const resp = function (callback) {
const callbacks = {
success: response => {
let responseObj;
if (response) {
try {
responseObj = JSON.parse(response);
} catch (error) {
utils.logError(error);
}
}
callback(responseObj);
},
error: error => {
utils.logError(`${MODULE_NAME}: ID fetch encountered an error`, error);
callback();
}
};
ajax(url, callbacks, undefined, {method: 'GET', withCredentials: true});
};
return {callback: resp};
}
};

submodule('userId', intentIqIdSubmodule);
6 changes: 6 additions & 0 deletions modules/userId/eids.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ const USER_IDS_CONFIG = {

// key-name : {config}

// intentIqId
'intentIqId': {
source: 'intentiq.com',
atype: 1
},

// pubCommonId
'pubcid': {
source: 'pubcid.org',
Expand Down
Loading