-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Start.io: Create User ID submodule and improve adapter #14583
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ee59d5a
Start.io - Create User ID submodule and improve adapter
IlliaMil c2e83fe
Update modules/startioIdSystem.md
IlliaMil 35908fb
Merge branch 'prebid:master' into master
IlliaMil 34c0b4e
Fix: Adjust spacing formatting in getStorageManager parameters
IlliaMil 6f37ca9
Fix: Adjust spacing formatting in getStorageManager parameters (#2)
IlliaMil 28c51c1
Refactor: Remove unused storage management logic from StartIO ID modu…
IlliaMil 3937eaa
Merge branch 'prebid:master' into master
IlliaMil 453a5e7
Merge branch 'refs/heads/master' into remove-manual-storage-management
IlliaMil e72fd1b
Refactor: Remove unused storage management logic from StartIO ID modu…
IlliaMil 42fa66f
Enhance: Add configurable storage options and expiration to StartIO I…
IlliaMil b71da0e
Docs: Update StartIO ID module documentation with storage configurati…
IlliaMil 95ae686
Docs: Update StartIO ID module documentation with storage configurati…
IlliaMil 14be6cc
Merge pull request #3 from startappdev/remove-manual-storage-management
IlliaMil 3c59bba
Merge branch 'master' into master
IlliaMil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /** | ||
| * This module adds startio ID support to the User ID module | ||
| * The {@link module:modules/userId} module is required | ||
| * @module modules/startioIdSystem | ||
| * @requires module:modules/userId | ||
| */ | ||
| import { logError, formatQS } from '../src/utils.js'; | ||
| import { submodule } from '../src/hook.js'; | ||
| import { ajax } from '../src/ajax.js'; | ||
| import { getUserSyncParams } from '../libraries/userSyncUtils/userSyncUtils.js'; | ||
|
|
||
| const MODULE_NAME = 'startioId'; | ||
| const GVLID = 1216; | ||
| const DEFAULT_ENDPOINT = 'https://cs.startappnetwork.com/get-uid-obj?p=m4b8b3y4'; | ||
|
|
||
| function fetchIdFromServer(callback, consentData) { | ||
| const consentParams = getUserSyncParams( | ||
| consentData?.gdpr, | ||
| consentData?.usp, | ||
| consentData?.gpp | ||
| ); | ||
| const queryString = formatQS(consentParams); | ||
| const url = queryString ? `${DEFAULT_ENDPOINT}&${queryString}` : DEFAULT_ENDPOINT; | ||
|
|
||
| const callbacks = { | ||
| success: response => { | ||
| let responseId; | ||
| try { | ||
| const responseObj = JSON.parse(response); | ||
| if (responseObj && responseObj.uid) { | ||
| responseId = responseObj.uid; | ||
| } else { | ||
| logError(`${MODULE_NAME}: Server response missing 'uid' field`); | ||
| } | ||
| } catch (error) { | ||
| logError(`${MODULE_NAME}: Error parsing server response`, error); | ||
| } | ||
| callback(responseId); | ||
| }, | ||
| error: error => { | ||
| logError(`${MODULE_NAME}: ID fetch encountered an error`, error); | ||
| callback(); | ||
| } | ||
| }; | ||
| ajax(url, callbacks, undefined, { method: 'GET', withCredentials: true }); | ||
| } | ||
|
|
||
| export const startioIdSubmodule = { | ||
| name: MODULE_NAME, | ||
| gvlid: GVLID, | ||
| decode(value) { | ||
| return value && typeof value === 'string' | ||
| ? { 'startioId': value } | ||
| : undefined; | ||
| }, | ||
| getId(config, consentData, storedId) { | ||
| if (storedId) { | ||
| return { id: storedId }; | ||
| } | ||
| if (config.storage && config.storage.expires == null) { | ||
| config.storage.expires = 90; | ||
| } | ||
| return { callback: (cb) => fetchIdFromServer(cb, consentData) }; | ||
| }, | ||
|
IlliaMil marked this conversation as resolved.
|
||
|
|
||
| eids: { | ||
| 'startioId': { | ||
| source: 'start.io', | ||
| atype: 1 | ||
| }, | ||
| } | ||
| }; | ||
|
|
||
| submodule('userId', startioIdSubmodule); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| ## Start.io User ID Submodule | ||
|
|
||
| The Start.io User ID submodule generates and persists a unique user identifier by fetching it from a Start.io-managed endpoint. This endpoint is fixed within the submodule implementation and is not configurable via Prebid.js parameters. The ID is stored in both cookies and local storage for subsequent page loads and is made available to other Prebid.js modules via the standard `eids` interface. | ||
|
|
||
| For integration support, contact prebid@start.io. | ||
|
|
||
| ### Prebid Params Enabling User Sync | ||
|
|
||
| To enable iframe-based user syncing for Start.io, include the `filterSettings` configuration in your `userSync` setup: | ||
|
|
||
| ```javascript | ||
| pbjs.setConfig({ | ||
| userSync: { | ||
| userIds: [{ | ||
| name: 'startioId', | ||
| storage: { | ||
| type: 'cookie&html5', // 'cookie', 'html5', or 'cookie&html5' | ||
| name: 'startioId', | ||
| expires: 90 // optional, 90 days by default | ||
| } | ||
| }], | ||
| filterSettings: { | ||
| iframe: { | ||
| bidders: ['startio'], | ||
| filter: 'include' | ||
| } | ||
| } | ||
| } | ||
| }); | ||
| ``` | ||
|
|
||
| This configuration allows Start.io to sync user data via iframe, which is necessary for cross-domain user identification. | ||
|
|
||
| ## Parameter Descriptions for the `userSync` Configuration Section | ||
|
|
||
| The below parameters apply only to the Start.io User ID integration. | ||
|
|
||
| | Param under userSync.userIds[] | Scope | Type | Description | Example | | ||
| | --- | --- | --- | --- | --- | | ||
| | name | Required | String | The name of this module. | `"startioId"` | | ||
|
IlliaMil marked this conversation as resolved.
|
||
| | storage | Required | Object | Storage configuration for the user ID. | | | ||
| | storage.type | Required | String | Type of storage: `"cookie"`, `"html5"`, or `"cookie&html5"`. | `"cookie&html5"` | | ||
| | storage.name | Required | String | The name used to store the user ID. | `"startioId"` | | ||
| | storage.expires | Optional | Number | Number of days before the stored ID expires. Defaults to `90`. | `365` | | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,6 +157,9 @@ pbjs.setConfig({ | |
| }, | ||
| { | ||
| name: "mygaruId" | ||
| }, | ||
| { | ||
| name: "startioId" | ||
| } | ||
| ], | ||
| syncDelay: 5000, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.