You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 52 Next »

Data partner integration guide for audiences

Use this guide to integrate audience segments with PubMatic. Data owners can create audience segments using:

  • Cookie IDs for mobile and desktop/web.
  • iOS IDFA/Android device IDs for mobile apps.
  • Custom IDs from ID providers who are integrated with PubMatic; contact your PubMatic account manager for details.

Data integration requires these steps:

  1. Audience Source creation
  2. Segment registration
  3. Data transfer

Audience Source creation

Registering audience segments requires an Audience Source/data partner ID (DPID); see, Create and Edit an Audience Source.

Segment registration

Register segments ONLY ONCE before data transfer

Register only the new segments you send.

Data providers must register new segments with source segment IDs before sending data to PubMatic. PubMatic ignores unrecognized segment IDs to avoid processing mistakenly sent data.

There are two ways to register segments:

  1. Register audience segments with the Segment Registration APIs; see, Register an Audience segment.

  2. Bulk-register segments in PubMatic at, Publisher Account > Audience > Audience Segments > Bulk Upload Segments:

You can bulk-register segments by uploading a correctly formatted CSV file. Download the CSV template from PubMatic:

Data transfer

Transfer audience data to PubMatic using one of the following methods:

Important

PubMatic automatically removes user IDs older than 30 days. The best practice is to refresh data at least every 25 days.

The transfer options listed above require data submission using a specific set of parameters listed in the table below.

Data transfer parameters

Parameter

Type

Required

API

SFTP

Description

dpid

integer

yes

yes

PubMatic data partner ID (DPID) assigned to the data partner at time of integration.

userid

string

yes

yes

The PubMatic user ID passed to the data partner by PubMatic.

uidtype

integer

yes

yes

A integer value that determines what the identity partner's PubMatic user ID represents:

  •     0 = UID represents a PubMatic cookie ID. Note: when using uidtype=0, you must first perform the UID sync step below.
  •     1 = UID represents a device ID.
  •     A different identity partner ID registered with PubMatic.

uidtype is now required for all new integrations

Contact your PubMatic account manager to learn more about UID Type assignment and other identity partners supported by PubMatic.

segid

string array


yes

yes

Use segid to send the complete list of audience segment IDs to which the user belongs. Each subsequent request for that user with the segid parameter overwrites the user’s already existing segments list.

DO NOT send segid in a request that also includes the addseg or remseg parameters.

Omitting segid removes the entire list of the user's audience segments; see, Remove a user from audiences.

addseg

string array


yes

no

Use addseg to send:

  • A complete list of comma-separated segment IDs to replace the user's current segments.
  • A list of new segments to append to the user’s current segments.

You can include addseg and remseg in the same request, but DO NOT send segid along with these parameters.

remseg

string


yes

no

Use remseg to send:

  • A complete list of comma-separated segment IDs to replace the user's current segments. 
  • A list of segments to remove from the user’s current segments.

You can include remseg and addseg in the same request, but DO NOT send segid along with these parameters.

ip

string


yes

yes

Last known IP address of the user; optional when you send country in the request. Omit this parameter from the request if the user's last IP address is unknown.

country

string


yes

yes

Two-letter code for the user's country; for example,  US, IN, CA; optional when you send the last known ip in the request. Exclude this parameter from the request if the user's country is unknown. If both country and ip are omitted, country defaults to US.

Server-to-server (S2S) data transfer

Server-to-server data transfer is the best practice for submitting data to PubMatic since the servers communicate directly, so data transfer is highly-efficient. Build API calls using the parameters from the data transfer parameter table and make HTTP calls to the API endpoint:

http://aud.pubmatic.com/AdServer/Artemis
Sample: standard call with segment IDs

In this request:

  • 89 is the data partner's PubMatic-assigned ID (DPID).
  • The user belongs to three audience segments with IDs 123_B, 98901, and 4532.
  • uidtype=0 means the user ID represents a cookie ID.

    If your user IDs represent PubMatic cookie IDs, you must first use UID sync .

http://aud.pubmatic.com/AdServer/Artemis?dpid=89&userid=B8CB98E6-0FF0-4C2B-A161-4F89155C28F&segid=123_B,98901,4532&country=US&uidtype=0
Sample: appending/removing segments

This request for the same data partner (dpid=89) and user (userid=B8CB98E6-0FF0-4C2B-A161-4F89155C28F):

  • adds segment ID 3242 to the user's existing list.

  • removes segment ID 123_B from the list.

  • sets the user's country to US.

  • specifies using the UID value as a device ID.


http://aud.pubmatic.com/AdServer/Artemis?dpid=89&userid=B8CB98E6-0FF0-4C2B-A161-4F89155C28F&addseg=3242&remseg=123_B&country=US&uidtype=1

Browser-side real-time (HTTP 302 redirect) data transfer

Data partners who do not support server-to-server data transfer can pass data to PubMatic using browser-side real-time data transfer for each visitor as follows:

  1. A user visits the website using a browser, which upon loading, executes the PubMatic pixel.
  2. The PubMatic pixel invokes the data partner's pixel or URL to request the audience segment data for this visitor. To reduce the latency, this request is sent to the data partner only once in a pre-configured time interval per user; for example, once per day.
  3. The data partner's system then redirects to the PubMatic Data Ingestion API using the HTTP 302 redirect. PubMatic shared the API URL with the data partner before the start of the integration. While redirecting to the API URL, the data partner's system must include all the IDs of the audience segments to which the visitor belongs.

    Data partner must also

    Provide the segment ID-to-segment name mapping to PubMatic only once at the start of the integration.

Browser-side sample requests

In this request, which updates the entire audience segments list:

  • 89 is the data partner's PubMatic-assigned ID.

  • B8CB98E6-0FF0-4C2B-A161-4F89155C28F is the PubMatic user ID (from UID sync).

  • the last known IP of the user: 74.125.236.123.

  • the user's country: US.

  • the user's DMP audience segment IDs: 123_B, 98901, and 4532.

  • uidtype=0 specifies that the user ID should be handled as a cookie ID (use UID sync when passing uidtype=0).

http://aud.pubmatic.com/AdServer/Artemis?dpid=89&userid=B8CB98E6-0FF0-4C2B-A161-4F89155C28F&ip=74.125.236.123&country=US&segid=123_B,98901,4532&uidtype=0

This request is also for data partner 89 and user ID B8CB98E6-0FF0-4C2B-A161-4F89155C28F. It removes and appends values to the audience segments list:

  • submits the user's last known IP as 74.125.236.123.

  • sets the user's country as US.

  • adds audience segment 3242 to the user's existing list of audience segments.

  • removes audience segment 123_B, leaving the user's updated audience segments as: 98901,4532,3242.

  • Sets uidtype=1 to specify that the user ID should be handled as a device ID.

http://aud.pubmatic.com/AdServer/Artemis?dpid=89&userid=B8CB98E6-0FF0-4C2B-A161-4F89155C28F&ip=74.125.236.123&country=US&addseg=3242&remseg=123_B&uidtype=1

For more information on all available parameters, see Data transfer parameters.

Bulk audience data transfer using SFTP

Use SFTP to transfer audience segment data to PubMatic within a tab-delimited file, where each row of the file contains the audience segment parameters separated by a tab character, with each row ending with a carriage-return as follows:

[DPID] [TAB] [USERID] [TAB] [SEGID] [TAB] [IP] [TAB] [COUNTRY] [TAB] [UIDTYPE] [CR]

The [SEGID] parameter refers to the Source Seg ID that was assigned to the segment during segment registration. You can submit multiple, comma-separated, source segment ID's.

For more information on the other parameters, see Data transfer parameters.

You must provide either

[IP] (last known IP address) or [COUNTRY] (two-letter country code). If [IP] is unknown, add two TABs between [SEGID] and [COUNTRY] with no additional blank/space characters. If neither [IP] nor [COUNTRY] are added to the entry, PubMatic will set the [COUNTRY] to US by default.

File name format

File names follow the pattern:

  <DPID>_<TIMESTAMP>_<MD5SUM>.tsv.gz
  • format should be Unix; for example, 1596695461984.
  • <MD5SUM> is an MD5 32-character hexadecimal checksum computed on the file content before compression.

If your organization is workload managed by a team, you can also include <WORKERID> as part of the file name to help track and manage the team member's workload:

  <DPID>_<TIMESTAMP>_<MD5SUM>_<WORKERID>.tsv.gz

While the transfer is in progress

Suffix the file with, * .UPLOADING, then rename it upon completion.

PubMatic supports compression formats such as, gzip , bzip2 , and others. If you have any questions or issues uploading a compressed file, please contact your PubMatic account manager for assistance.

The tsv.gz suffix must follow the uploaded file name. Please verify that the file name is correct once upload completes.

Sample entries
103 5AFCD4CD-F9B6-4E53-B63D-BFB2CF44941D 4666 74.125.236.123 0


103 34E1EA68-8EDA-4254-9BD0-AB24BCC13914 4666 US 1

Bulk transfer notes

  1. FTP lets a single user batch upload data for multiple partners, while HTTP allows data for only a single partner.
  2. HTTP lets a DMP add/remove a segment for a given user id, but FTP requires the DMP to send all the user's segment IDs, which overrides the existing segment stored with PubMatic.
  3. FTP allows only one new line entry for each segment for a given user.
SFTP server details and access

Provided separately by PubMatic. Contact your PubMatic account manager with questions.

Unique identifier (UID) sync

PubMatic can process data only from PubMatic user IDs

To use data from other sources when using uidtype=0, a data provider must create a user-match table between PubMatic's user IDs and their own user IDs.

Steps for user sync-up:

  1. The data provider must provide PubMatic with an image pixel similar to: 

        <img src=" http://partner.com/xxxx?id=UID" width=1 height=1>

  2. If data comes from a publisher, then PubMatic incorporates the image pixel from step 1 in a PubMatic pixel. The publisher must fire the PubMatic pixel across their website to maximize coverage across their users. Firing the pixel also lets the data provider create the match-table.
  3. If data comes from a buyer, PubMatic fires the image pixel from step 1 across PubMatic's site.

Remove a user from audiences

Use one of the following methods to remove a user from all of their audiences (DMPs and publishers can use either method):

  1. When sharing data via a Server-to-Server (S2S) call or browser redirect mechanism, exclude the segid parameter from the S2S call to PubMatic. See Data transfer parameter reference.

    EXAMPLES:

    http://aud.pubmatic.com/AdServer/Artemis?dpid=89&userid=5AFCD4CD-F9B6-4E53-B63D-BFB2CF44941D&uidtype=[Identity_Partner_ID]

    OR

    To send a list of segments to remove using the remseg parameter: 

    http://aud.pubmatic.com/AdServer/Artemis?dpid=89&userid=5AFCD4CD-F9B6-4E53-B63D-BFB2CF44941D&remseg=123_B,3242&uidtype=[Identity_Partner_ID]
  2. When sharing data via a bulk file, do not pass any segment ID in the file for the user record. Audiences in the latest record are stored for the user ID, overwriting the user's previous audiences.

⇧ Top

Do you have feedback on this document? Let us know: email us.

Table of Contents