Skip to content

Conversation

@aulme
Copy link
Contributor

@aulme aulme commented Jul 21, 2025

No description provided.

JOIN uid_mapping um ON (imp.uid = um.current_uid OR imp.uid = um.previous_uid)
JOIN conversions conv ON (conv.uid = um.current_uid OR conv.uid = um.previous_uid)
WHERE um.opt_out = FALSE
ORDER BY RANDOM()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we want to order by random here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for the demo - we're showing 10 rows, if we don't order by random you'll just see a bunch of rows for the same impression.


### 3. Run Complete Demo
```bash
# Full workflow: test data → UID2 mapping → attribution analysis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would help to be more specific that it is 'test data population'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will add

Copy link
Collaborator

@genwhittTTD genwhittTTD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't finish. looks great but multiple small copy fixes.

Hoping you could address and I could look again tomorrow -- or even, if you want, I could address... but there are a couple of questions I've marked. Hope this helps anyway. I will look again tomorrow.


## Integration Example

For a complete demonstration of a working integration that includes all the recommended patterns, see the [UID2 Identity Map V3 Integration Example](https://github.com/IABTechLab/uid2docs/blob/main/static/examples/identity-map-integration-example).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V3 > v3 -- could we do this in the destination please? Or say Version 3

## Integration Example

For a complete demonstration of a working integration that includes all the recommended patterns, see the [UID2 Identity Map V3 Integration Example](https://github.com/IABTechLab/uid2docs/blob/main/static/examples/identity-map-integration-example).
While the sample is implemented using the Python SDK, the integration patterns are applicable to any SDK or direct API integration.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't the main meaning for "while" so better not to use it, to avoid possible misunderstanding..
From
While the sample is implemented using the Python SDK, the integration patterns are applicable to any SDK or direct API integration.
To
The sample uses the Python SDK, but the integration patterns are applicable to any SDK or direct API integration.

For a complete demonstration of a working integration that includes all the recommended patterns, see the [UID2 Identity Map V3 Integration Example](https://github.com/IABTechLab/uid2docs/blob/main/static/examples/identity-map-integration-example).
While the sample is implemented using the Python SDK, the integration patterns are applicable to any SDK or direct API integration.

For step-by-step setup instructions and to run the example, see the [Integration Example README](https://github.com/IABTechLab/uid2docs/blob/main/static/examples/identity-map-integration-example/README.md).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the link copy, use the title of the destination doc. In which case we don't need "the" also.
From:
see the [Integration Example README]
To:
see [UID2 Integration Technical Sample]

| [5: Monitor for Raw UID2 Refresh](#5-monitor-for-raw-uid2-refresh) | Use the refresh timestamp (`r` field) returned from the [POST /identity/map](../endpoints/post-identity-map.md) endpoint to determine when to refresh Raw UID2s. |
| [6: Monitor for Opt-Out Status](#6-monitor-for-opt-out-status) | API call to the [POST /optout/status](../endpoints/post-optout-status.md) endpoint. |

## Integration Example
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Is this identical copy? If yes -- on the short term, same edits.
    But, better if we implement as a snippet. I can do it if you want.

  2. A question. Is this applicable to Snowflake, and/or AWS Entity Resolution?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is and it is applicable to Snowflake. Gian is finishing changes to that doc now. This is not applicable to AWS Entity Resolution.

I'll make changes you've suggested above across the board.
Didn't know about snippets, could you please help with that?

mixed_response = client.generate_identity_map(mixed_input)
```

### Integration Example
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the identical copy, same edits and preferably a snippet... same as prior comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a subtle difference for Python SDK vs the others - in other places I say that the pattern is applicable despite the example using Python SDK, here I don't. Not sure it's worth keeping them separate though - happy to make it the same.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aulme that makes sense, thx. But I do think we should have a snippet. I think it'd be OK to still have that line in the Python SDK doc... it's kind of unnecessary data but I don't think it sounds weird. It's just info.

LMK if you want me to do that for you in the branch.

WHERE opt_out = FALSE
AND (current_uid IS NULL OR refresh_from < datetime('now'));

-- Attribution joins using both current and previous UIDs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UIDs > UID2s


**Patterns for UID2 Integration:**

**Request Limits**: Maximum 5,000 DIIs per request
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As previous. Don't say DIIs anywhere.

**Sequential Processing**: No parallel requests to UID2 service
**Retry Logic**: Exponential backoff for network failures
**Optout Handling**: Permanent exclude opted out users from future processing
**Token Refresh**: Re-map tokens when they reach `refresh_from` timestamps
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it tokens, not raw UID2s?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I raw UID2s, used colloquially

[project]
name = "identity-map-tech-sample-2"
version = "0.1.0"
description = "UID2 Identity Map V3 technical sample demonstrating email/phone to UID2 mapping with proper optout handling"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V3 > v3

optout handling > opt-out handling

Copy link
Collaborator

@genwhittTTD genwhittTTD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aulme thanks for the fixes. One more small mod on the shared cotent, for a line break.
Some instances of UID that should be UID2, still.
Also instances of DIIs -- I'd really like if we didn't have this, even in the code. It's not correct.

All else looks great, thx.

### Integration Example

For a complete demonstration of a working integration that includes all the recommended patterns, see the [UID2 Identity Map v3 Integration Example](https://github.com/IABTechLab/uid2docs/blob/main/static/examples/identity-map-integration-example).
The sample uses the Python SDK, but the integration patterns are applicable to any SDK or direct API integration.
Copy link
Collaborator

@genwhittTTD genwhittTTD Jul 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need one extra line break to make a new para. Assuming you want a new para here. Same for all 4 instances.

mixed_response = client.generate_identity_map(mixed_input)
```

### Integration Example
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aulme that makes sense, thx. But I do think we should have a snippet. I think it'd be OK to still have that line in the Python SDK doc... it's kind of unnecessary data but I don't think it sounds weird. It's just info.

LMK if you want me to do that for you in the branch.

| `src/populate_test_uid_mappings.py` | Creates 100k test records | Database schema, DII formatting |
| `src/map_identities.py` | **Core UID2 mapping logic** | Batch processing, retry logic, response handling |
| `src/populate_test_conversions_impressions.py` | Attribution demo data | UID2 token usage in measurement |
| `src/attribution_analysis.py` | Attribution analysis | Cross-UID joins, measurement patterns |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UID > UID2

@@ -0,0 +1,45 @@
#!/usr/bin/env python3
"""
Complete demo of UID Identity Mapping:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UID > UID2

Should be everywhere except code. Since this is for the UID2 site, not shared content.

Complete demo of UID Identity Mapping:
- Creates a test database.
- Populates the database with test identity mapping data.
- Runs the UID mapping process.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UID > UID2



def build_uid_input(records: list[IdentityToMap]) -> tuple[IdentityMapV3Input, list[str]]:
"""Build UID input object from database records.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UID > UID2

@@ -0,0 +1,114 @@
#!/usr/bin/env python3
"""
UID Attribution Test Data Population
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UID > UID2

UID Attribution Test Data Population
Creates impression and conversion test data using actual mapped UIDs.
Should be run AFTER UID mapping is complete.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UID > UID2



def generate_uid() -> str:
"""Generate a UID for testing"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UID > UID2

print(f" Opted out: {opted_out_count}")
print(f" Up for refresh: {refresh_needed_count}")
print(f" Never mapped: {never_mapped_count}")
print(f" Invalid DIIs: {invalid_dii_count}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get "DIIs" out? Maybe even out of the code? It would be better to say DII. It's a collective term. More than one email address or phone number is still DII.

There are multiple instances. I didn't mark them because they're in the code but if we change them all it will work I think? It would be good to not have this, even in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants