
{
    "kind": "term",
    "name": "Tealium Identity Partners",
    "count": 18,
    "items": [

    
        {
            "weight": "-10",
            "url": "https://docs-preview.tealium.com/industries/tealium-identity-partners/about/",
            "title": "The Identity Partner Ecosystem",
            "body": "<p>Tealium relies on deterministic information sources to use PII to stitch visitor data together into a visitor profile for a single customer view. However, you can use identity providers of first-party and third-party data, which often rely on probabilistic methods of identity resolution, to create high-quality insights about each visitor, prospect and customer. These probabilistic insights can be combined with data collected and profiles enriched by Tealium to enhance relationship data and provide personalized experiences to customers.</p>\n<h2 id=\"what-do-identity-providers-do\">What do Identity Providers do?</h2>\n<p>Tealium’s Identity Partners provide the following services:</p>\n<ul>\n<li>Collect first party and third party data into a single customer database. This can be used as a CRM itself, or used to enhance a CRM that a business owns.</li>\n<li>Collect, clean, and normalize first party data in an ongoing process to ensure the quality of their service.</li>\n<li>Integrate with UID2.0, the open source ID framework that will be replacing third-party cookies. For example, The Trade Desk offers UID 2.0, which allows the advertiser to share PII, and they send back a short-term anonymous identifier for ad targeting.</li>\n<li>Some data providers also provide AdTech and publisher-related features. These direct integrations with publisher platforms can support ad targeting, and others allow analysis of ad campaigns in privacy-compliant environments.</li>\n</ul>\n<p>Tealium provides access to a large number of identity partner integrations across the platform: iQ Tag Management, EventStream, Data Source, AudienceStream, and Functions. Because it can be a lot of work pulling information from each of these sources and combining it into a clear vision of your visitor and customer profile, Tealium is here to make the process of integrating identity provider data from multiple sources smoother and easier.</p>\n<h3 id=\"deterministic-vs-probabilistic\">Deterministic vs Probabilistic</h3>\n<p>It is important to understand the difference between deterministic matching and probabailistic data models:</p>\n<ul>\n<li>Deterministic matching uses first-party data to link device-level data to the appropriate user profiles.</li>\n<li>Probabilistic models use predictive algorithms to link user data to an individual based on a confidence level.</li>\n</ul>\n<p>The deterministic method uses PII (email, UID2.0, etc.) to identify the user. Tealium employs the deterministic model with visitor stitching.</p>\n<p>Integrations with probabilistic identity programs typically require the use of Tealium’s functions to process returned data along with the confidence score.</p>\n<h2 id=\"how-it-works\">How it works</h2>\n<h3 id=\"auth0-and-ciam\">Auth0 and CIAM</h3>\n<p>Auth0 uses the Customer Identity Access Management (CIAM) model:</p>\n<figure><a class=\"slb\" href=\"/images/industries/screen-shot-2022-09-26-at-13.41.19.png\"><img src=\"https://docs.tealium.com/images/industries/screen-shot-2022-09-26-at-13.41.19.png\"/>\n    </a>\n</figure>\n<p>When the user logs in to Auth0, their identity is confirmed by the Auth0 authorization server.</p>\n<p>Tealium appears as an Auth0 action, which can be used through drag and drop integration.</p>\n<p>The Auth0 data source appears under the new <strong>Identity</strong> category in Tealium.</p>\n<h3 id=\"uid-20\">UID 2.0</h3>\n<p>The Trade Desk and other vendors use UID 2.0, which uses PII for deterministic identification. You will need to configure an enrichment and function code to assign a UID 2.0 to a visitor:</p>\n<figure><a class=\"slb\" href=\"/images/industries/screen-shot-2022-09-26-at-13.41.53.png\"><img src=\"https://docs.tealium.com/images/industries/screen-shot-2022-09-26-at-13.41.53.png\"/>\n    </a>\n</figure>\n<p>For more information, see <a href=\"/server-side/functions/event-visitor-functions/uid2/\">Using Tealium Functions to Generate a UID2.0 Token</a>.</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>UID 2.0 cannot be used in the EU due to privacy restrictions.</p>\n<h3 id=\"acxiom-and-merkle\">Acxiom and Merkle</h3>\n<p>As identity and data management solution providers, Acxiom and Merkle perform the following roles:</p>\n<ul>\n<li>Provide customer data strategies, and additional optional services.</li>\n<li>Require access to Functions and Tealium iQ Tag Management.</li>\n<li>Cleanse and store first and third party data for businesses, which can group profiles into households, gather demographics, track NCOA (National Change of Address), and more.</li>\n<li>Identify visitors through probabalistic methods to &ldquo;stitch deterministically, enrich probabalistically.&rdquo;</li>\n</ul>\n<figure><a class=\"slb\" href=\"/images/industries/data-partners-&#43;-tealium---acxiom-%283%29.png\"><img src=\"https://docs.tealium.com/images/industries/data-partners-&#43;-tealium---acxiom-%283%29.png\"/>\n    </a>\n</figure>\n<h3 id=\"netid\">netID</h3>\n<p>After login or registration with a netID on a website, the user’s netID identity parameter is available to Tealium’s real-time data collection, enrichment, and activation capabilities.</p>\n<p>When the user logs in on a website with netID authentication, their identity is confirmed by the netID authentication API. The identity parameter <code>tpid</code> from the API <code>READ SERVICE</code> response can be persisted in the Tealium data layer.</p>\n<ul>\n<li>Use netID within Tealium iQ load rules and tag variable mapping for client-side activation to your advertising technologies, where supported.</li>\n<li>Use netID within Tealium EventStream rules, event feeds, and connector attribute mappings for server-side activation to your advertising technologies, where supported.</li>\n<li>Use netID to enrich Tealium AudienceStream visitor profiles and to map connector attributes for customer profile-based activation and suppression across your advertising technologies, where supported.</li>\n</ul>\n<h2 id=\"how-you-can-use-identity-providers\">How you can use Identity Providers</h2>\n<p>You can use an identity provider to immediately share PII such as phone numbers and email addresses with Tealium to enrich customer profiles. This lets you turn anonymous visitors into known visitors or customers.</p>\n<p>Because data providers constantly clean and normalize their data, you can use this information to help clean your own data.</p>\n<p>As third party cookies are deprecated, anonymous retargeting will no longer be possible. So sharing one or more pieces of PII with AdTech ID partners allows identification and targeting of that individual across publishers and domains.</p>\n<p>Many customers have already hired third-party identity providers to improve their visitor profiles. The Tealium Identity Marketplace can help simplify the process of subscribing to, importing, and incorporating this data.</p>\n<h2 id=\"identity-tags-connectors-and-data-sources\">Identity Tags, Connectors, and Data Sources</h2>\n<p>The <strong>Identity</strong> category in each of the <strong>Tags</strong>, <strong>Connectors</strong>, and <strong>Data Sources</strong> interfaces lists all of the available identifier resources for that part of the platform.</p>\n<h3 id=\"identity-and-data-management-solutions\">Identity and Data Management Solutions</h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Partner</th>\n<th style=\"text-align:left\">Integration Type</th>\n<th style=\"text-align:left\">Summary</th>\n<th style=\"text-align:left\">Documentation Link</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\">Acxiom</td>\n<td style=\"text-align:left\">Tag</td>\n<td style=\"text-align:left\"><ul><li>First-party tag implemented across brand’s owned and paid media.</li><li>Provides a unified and consistent identity across owned and paid media.</li><li>Allows for linkages to be built by both deterministic and probabilistic signals.</li><li>Operates as a fully first-party solution, meaning running off of the client’s own domain and with no data sharing with other entities.</li><li>Able to resolve identities even in the absence (or non-acceptance) of cookies</li></ul></td>\n<td style=\"text-align:left\"><a href=\"/client-side-tags/acxiom-real-identity-rtag/\">Acxiom Real Identity rTag Setup Guide</a></td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Auth0</td>\n<td style=\"text-align:left\">Data Source</td>\n<td style=\"text-align:left\">An action within the Auth0 integration market that sends user data from Auth0 upon login</td>\n<td style=\"text-align:left\"><a href=\"https://marketplace.auth0.com/integrations/tealium\">Tealium Integrations at Auth0</a></td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Merkle</td>\n<td style=\"text-align:left\">Tag</td>\n<td style=\"text-align:left\">Merkury uses an organization’s first-party CRM data and valuable interactions such as logins, outbound email campaigns and media reach to create and grow a universe of person-based IDs. Tealium IQ’s data mapping feature lets you control which data points are shared with Merkury.</td>\n<td style=\"text-align:left\"><a href=\"/client-side-tags/merkle-merkury-tag/\">Merkle Merkury Tag Setup Guide</a></td>\n</tr>\n<tr>\n<td style=\"text-align:left\">netID</td>\n<td style=\"text-align:left\">Data Layer (UDO object)</td>\n<td style=\"text-align:left\">To implement the netID Login Standard, netID partners implement the netID browser-based Javascript API request on their website, and persist netID identity and privacy properties in browser storage, such as first-party-cookies, localStorage, or sessionStorage, where Tealium can pick them up for downstream activation.</td>\n<td style=\"text-align:left\"><a href=\"/industries/tealium-identity-partners/netid-identity-resolution/\">netID Implementation Guide</a></td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"advertising-identity-services\">Advertising Identity Services</h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Partner</th>\n<th style=\"text-align:left\">Integration Type</th>\n<th style=\"text-align:left\">Summary</th>\n<th style=\"text-align:left\">Documentation Link</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\">Criteo</td>\n<td style=\"text-align:left\">Tag</td>\n<td style=\"text-align:left\">Cookie Matching associates a cookie that identifies a Tealium visitor to the cookie that identifies the user for Criteo.</td>\n<td style=\"text-align:left\"><a href=\"/client-side-tags/criteo-cookie-matching-service-tag/\">Criteo Cookie Matching Service Tag Setup Guide</a></td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Criteo</td>\n<td style=\"text-align:left\">Connector</td>\n<td style=\"text-align:left\">Audience Match is a flexible customer targeting solution.</td>\n<td style=\"text-align:left\"><a href=\"/server-side-connectors/criteo-audiences-connector/\">Criteo Audiences Connector Setup Guide</a></td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Epsilon</td>\n<td style=\"text-align:left\">Tag</td>\n<td style=\"text-align:left\">Returns a list of partner pixel URLs that, when called by the browser, synchronize IDs with exchanges. This allows users can to be identified and messaged after they leave your site.</td>\n<td style=\"text-align:left\"><a href=\"/client-side-tags/epsilon-partner-sync-web-service-tag/\">Epsilon Partner Sync Web Service Tag Setup Guide</a></td>\n</tr>\n<tr>\n<td style=\"text-align:left\">The Trade Desk (TDD)</td>\n<td style=\"text-align:left\">Tag</td>\n<td style=\"text-align:left\">The Trade Desk Universal Pixel enables marketers to gain more visibility into user data, and analyze reporting at a more granular level.</td>\n<td style=\"text-align:left\"><a href=\"/client-side-tags/the-trade-desk-universal-pixel-tag/\">Trade Desk Universal Pixel Setup Guide for Tealium iQ</a></td>\n</tr>\n<tr>\n<td style=\"text-align:left\">The Trade Desk (TDD)</td>\n<td style=\"text-align:left\">Connector</td>\n<td style=\"text-align:left\">The Trade Desk Connector can be used for posting enriched Visitor Profiles and Audiences to TDD for more personalized advertising campaigns.</td>\n<td style=\"text-align:left\"><a href=\"/client-side-tags/the-trade-desk-cookie-matching-service-tag/\">The Trade Desk Cookie Matching Service Tag Setup Guide</a> (used with UID2.0 Function)</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">The Trade Desk (TDD)</td>\n<td style=\"text-align:left\">Function</td>\n<td style=\"text-align:left\">UID2.0 is an open source identifier that replaces third-party cookies.</td>\n<td style=\"text-align:left\"><a href=\"/server-side-connectors/the-trade-desk-connector/\">The Trade Desk Connector Setup Guide</a> (used with UID2.0 Function)</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"identity-provider-privacy-restrictions\">Identity provider privacy restrictions:</h3>\n<p>Identity Partners have limitations on where they can operate due to legislation such as the GDPR. Each partner will have different capabilities (for example, Merkle is Global, while the TDD UID2.0 cannot be used within the EU).</p>\n<ul>\n<li>Acxiom - <a href=\"https://www.acxiom.com/data-privacy-ethics/gdpr/\">GDPR</a></li>\n<li>Auth0 - <a href=\"https://auth0.com/docs/secure/data-privacy-and-compliance/gdpr\">Auth0 General Data Protection Regulation Compliance</a></li>\n<li>Criteo - <a href=\"https://www.criteo.com/blog/gdpr-need-know-criteo/\">GDPR: What You Need to Know | Criteo</a></li>\n<li>Epsilon - <a href=\"https://www.epsilon.com/emea/insights/blog/gdpr-steps-towards-compliance\">GDPR: Steps towards compliance</a></li>\n<li>Merkle - <a href=\"https://merkleinc.ch/en/data-protection\">Data Protection Statement</a></li>\n<li>Tapad - <a href=\"https://www.tapad.com/global-privacy-notice\">Privacy Notice - Global</a></li>\n<li>TDD - <a href=\"https://github.com/UnifiedID2/\">UnifiedID2</a></li>\n</ul>\n<h2 id=\"how-to-implement-an-identity-provider\">How to implement an identity provider</h2>\n<p>To implement identity providers:</p>\n<ul>\n<li>For The Trade Desk and UID 2.0, see <a href=\"/server-side/functions/event-visitor-functions/uid2/\">Using Tealium Functions to Generate a UID2.0 Token</a>.</li>\n<li>For Acxiom, see <a href=\"../acxiom-identity-resolution/\">Using Tealium Functions for Acxiom Identity Resolution</a>.</li>\n<li>For netID, see <a href=\"/industries/tealium-identity-partners/netid-identity-resolution/\">netID Implementation Guide</a>.</li>\n</ul>\n<p>We will add more function examples soon.</p>\n"
        }  

    , 
        {
            "weight": "80",
            "url": "https://docs-preview.tealium.com/server-side/functions/event-visitor-functions/uid2/",
            "title": "Generate a UID2 with a visitor function",
            "body": "<h2 id=\"how-uid2-works\">How UID2 works</h2>\n<p>Unified ID 2.0 (UID2) is an open source ID framework from <a href=\"https://www.thetradedesk.com/us/about-us/industry-initiatives/unified-id-solution-2-0#technical-documentation\">The Trade Desk</a>. UID2 replaces third-party cookies with a deterministic user identifier based on personally identifiable information (PII), such as an email address or phone number. The identifier is hashed and encrypted to create a UID2, which is returned in response to a UID2 request. For more information, see <a href=\"https://unifiedid.com/docs/intro\">The Trade Desk: UID2 documentation</a>.</p>\n<p>A UID2 is supported in <a href=\"/server-side-connectors/the-trade-desk-first-party-data-connector/\">The Trade Desk connector</a> and other outbound connectors.</p>\n<h2 id=\"create-a-visitor-function\">Create a visitor function</h2>\n<p>We recommend that you use a visitor function to generate a UID2 for each visitor who has PII but no UID2. The function creates the UID2, sends it with the <code>tealium_visitor_id</code> to Tealium Collect, and updates the visitor’s profile.</p>\n<p>For details about visitor functions, see <a href=\"/server-side/functions/event-visitor-functions/about/\">About event and visitor functions</a>.</p>\n<h3 id=\"prerequisites\">Prerequisites</h3>\n<p>Before you create a visitor function to generate a UID2:</p>\n<ul>\n<li><strong>Define UID2 event spec</strong>: Create a UID2 event spec with attributes for the data received from The Trade Desk (<code>uid_identifier</code>, <code>uid2</code>, <code>uid_timestamp</code>). The function uses this event spec to send an event to Tealium Collect. For more information, see <a href=\"/server-side/event-health/manage-event-specifications/\">Manage event specifications</a> and <a href=\"/server-side/attributes/enrichments/\">About enrichments</a>.<br>\n<figure><a class=\"slb\" href=\"/images/server-side/functions-uid2_event_spec.png\"><img src=\"https://docs.tealium.com/images/server-side/functions-uid2_event_spec.png\"\n           alt=\"Example event specification\"\n           title=\"Example event specification\"/>\n      </a>\n  </figure></li>\n<li><strong>Select PII attributes</strong>: Choose a PII attribute or attributes to identify users. UID2 version 3 supports a phone number, an email address, or both. Version 2 supports either a phone number or an email address.</li>\n<li><strong>Create UID2 visitor attribute</strong>: Create a visitor attribute to store the UID2. Add an enrichment to update this visitor attribute with the value of the event UID2 attribute. For more information, see <a href=\"/server-side/attributes/about/\">Using Attributes</a> and <a href=\"/server-side/attributes/enrichments/\">About enrichments</a>.</li>\n<li><strong>Build identified audience</strong>: Create an audience for identified visitors (those with an email address, phone number, or other identifier) who do not have a UID2.<br>\n<figure><a class=\"slb\" href=\"/images/server-side/uid2-function-trigger-example.png\"><img src=\"https://docs.tealium.com/images/server-side/uid2-function-trigger-example.png\"\n           alt=\"uid2-function-trigger-example.png\"\n           title=\"uid2-function-trigger-example.png\"/>\n      </a>\n  </figure><br>\nFor more information, see <a href=\"/server-side/audiences/manage/#create-an-audience\">Create an audience</a>.</li>\n</ul>\n<h3 id=\"configure-the-visitor-function\">Configure the visitor function</h3>\n<p>To configure the visitor function:</p>\n<ol>\n<li>For the trigger, select <strong>Processed Visitor</strong>.</li>\n<li>For <strong>Audience</strong>, select the audience created for identified visitors without a UID2.</li>\n<li>For <strong>Trigger On</strong>, select <code>Joined Audience</code>.</li>\n<li>Replace the default code with the <a href=\"#example-code\">example code</a>.</li>\n<li>Modify the example code as needed. (<code>TODO</code> comments in the code mark required changes.)</li>\n</ol>\n<h2 id=\"example-code\">Example code</h2>\n<h3 id=\"version-3\">Version 3</h3>\n<p>Version 3 supports multiple identifiers, such as email addresses and phone numbers, in a single request. Update the attribute IDs in the code to match your data. The code prioritizes the email UID, but you can change this as needed. The <code>track()</code> method runs only if the returned UID does not match the existing visitor UID.</p>\n<p>The Trade Desk configuration attributes (<code>api_key</code>, <code>secret</code>) and the UID2 attribute ID are grouped in the <code>ttd_config</code> object at the start of the script.</p>\n\n<div class=\"pv2\">\n<div class=\"expand ba pa2 b--black-20 pv3\">\n    <div class=\"expand-label\" style=\"cursor: pointer;\" onclick=\"$h = $(this);$h.next('div').slideToggle(100,function () {$h.children('i').attr('class',function () {return $h.next('div').is(':visible') ? 'fas fa-chevron-down' : 'fas fa-chevron-right';});});\">\n        <i style=\"font-size:x-small;\" class=\"fas fa-chevron-right\"></i>\n        <span style=\"font-weight:bold;\">\n        \n    \t\n    \tExpand to view code\n    \t\n    \t</span>\n    </div>\n    <div class=\"expand-content pa2\" style=\"display: none;\">\n        <div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-js\" data-lang=\"js\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">import</span> <span style=\"color:#a6e22e\">CryptoES</span> <span style=\"color:#a6e22e\">from</span> <span style=\"color:#e6db74\">&#39;crypto-es&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">activate</span>(<span style=\"color:#66d9ef\">async</span> ({ <span style=\"color:#a6e22e\">visitor</span>, <span style=\"color:#a6e22e\">visit</span>, <span style=\"color:#a6e22e\">helper</span> }) =&gt; {\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">genHash</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">data</span>) =&gt; <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">SHA256</span>(<span style=\"color:#a6e22e\">data</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>);\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">validateEmail</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">email</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> String(<span style=\"color:#a6e22e\">email</span>).<span style=\"color:#a6e22e\">toLowerCase</span>().<span style=\"color:#a6e22e\">match</span>(\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">/^(([^&lt;&gt;()[\\]\\\\.,;:\\s@&#34;]+(\\.[^&lt;&gt;()[\\]\\\\.,;:\\s@&#34;]+)*)|.(&#34;.+&#34;))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/</span>\n</span></span><span style=\"display:flex;\"><span>    );\n</span></span><span style=\"display:flex;\"><span>  };\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">// TODO: Update the following Trade Desk configuration attributes.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">ttd_config</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">api_key</span> <span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;TTD_API_KEY&#39;</span>, <span style=\"color:#75715e\">// TODO: Change TTD_API_KEY to your TTD API Key.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#a6e22e\">secret</span> <span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;UID2_SECRET&#39;</span> <span style=\"color:#75715e\">// TODO: Change UID2_SECRET to your TTD UID2 secret.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  };\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">// TODO: Update the following Tealium configuration attributes as needed.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">tealium_config</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_account</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_profile</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_datasource</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;DATA_SOURCE_KEY&#39;</span>, <span style=\"color:#75715e\">// TODO: Change DATA_SOURCE_KEY to your Tealium Data Source key.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#a6e22e\">email_hashed</span><span style=\"color:#f92672\">:</span> <span style=\"color:#66d9ef\">false</span>, <span style=\"color:#75715e\">// TODO: If your email is already hashed, set this to true.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#a6e22e\">phone_hashed</span><span style=\"color:#f92672\">:</span> <span style=\"color:#66d9ef\">false</span>, <span style=\"color:#75715e\">// TODO: If your phone is already hashed, set this to true.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#a6e22e\">email_attr_id</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;EMAIL_ATTRIBUTE_ID&#39;</span>, <span style=\"color:#75715e\">// TODO: Change to the attribute with the visitor&#39;s email.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#a6e22e\">phone_attr_id</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;PHONE_ATTRIBUTE_ID&#39;</span>, <span style=\"color:#75715e\">// TODO: Change to the attribute with the visitor&#39;s phone.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#a6e22e\">current_uid2_attr_id</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;CURRENT_UID2_ATTRIBUTE_ID&#39;</span> <span style=\"color:#75715e\">// TODO: Change to the attribute with the visitor&#39;s UID2.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  };\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_account</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_account</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">properties</span>.<span style=\"color:#a6e22e\">account</span>;\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_profile</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_profile</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">properties</span>.<span style=\"color:#a6e22e\">profile</span>;\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">email</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">getAttributeValueById</span>(<span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">email_attr_id</span>);\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">phone</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">getAttributeValueById</span>(<span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">phone_attr_id</span>);\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">current_uid</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">getAttributeValueById</span>(<span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">current_uid2_attr_id</span>);\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">tealium_vid</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">properties</span>.<span style=\"color:#a6e22e\">visitor_id</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">email_hash</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">null</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">email</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">email_hashed</span>) {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">validateEmail</span>(<span style=\"color:#a6e22e\">email</span>)) {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#66d9ef\">throw</span> <span style=\"color:#66d9ef\">new</span> Error(<span style=\"color:#e6db74\">&#39;Email is not valid&#39;</span>);\n</span></span><span style=\"display:flex;\"><span>      }\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">email_hash</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">genHash</span>(<span style=\"color:#a6e22e\">email</span>);\n</span></span><span style=\"display:flex;\"><span>    } <span style=\"color:#66d9ef\">else</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">email_hash</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">email</span>;\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">phone_hash</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">null</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">phone</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">phone_hash</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">phone_hashed</span> <span style=\"color:#f92672\">?</span> <span style=\"color:#a6e22e\">phone</span> <span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">genHash</span>(<span style=\"color:#a6e22e\">phone</span>);\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">email_hash</span> <span style=\"color:#f92672\">&amp;&amp;</span> <span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">phone_hash</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">throw</span> <span style=\"color:#66d9ef\">new</span> Error(<span style=\"color:#e6db74\">&#39;Provide at least one identity: email or phone.&#39;</span>);\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">url</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;https://prod.uidapi.com/v3/identity/map&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">key</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">ttd_config</span>.<span style=\"color:#a6e22e\">secret</span>);\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">hexRef</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#34;0123456789abcdef&#34;</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">randomBytes</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">bytes</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">for</span> (<span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#ae81ff\">0</span>; <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">&lt;</span> <span style=\"color:#a6e22e\">bytes</span> <span style=\"color:#f92672\">*</span> <span style=\"color:#ae81ff\">2</span>; <span style=\"color:#a6e22e\">i</span><span style=\"color:#f92672\">++</span>)\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">+=</span> <span style=\"color:#a6e22e\">hexRef</span>.<span style=\"color:#a6e22e\">charAt</span>(Math.<span style=\"color:#a6e22e\">floor</span>(Math.<span style=\"color:#a6e22e\">random</span>() <span style=\"color:#f92672\">*</span> <span style=\"color:#a6e22e\">hexRef</span>.<span style=\"color:#a6e22e\">length</span>));\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">buf</span>;\n</span></span><span style=\"display:flex;\"><span>  };\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">writeBigUint64BE</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">num</span>, <span style=\"color:#a6e22e\">bytes</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#ae81ff\">8</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">num</span>.<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#ae81ff\">16</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">padding</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">for</span> (<span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#ae81ff\">0</span>; <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">&lt;</span> <span style=\"color:#a6e22e\">bytes</span> <span style=\"color:#f92672\">*</span> <span style=\"color:#ae81ff\">2</span> <span style=\"color:#f92672\">-</span> <span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">length</span>; <span style=\"color:#a6e22e\">i</span><span style=\"color:#f92672\">++</span>)\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">padding</span> <span style=\"color:#f92672\">+=</span> <span style=\"color:#e6db74\">&#39;0&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">padding</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">buf</span>;\n</span></span><span style=\"display:flex;\"><span>  };\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">encrypt</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">data</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">iv</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">randomBytes</span>(<span style=\"color:#ae81ff\">12</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">nonce</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">randomBytes</span>(<span style=\"color:#ae81ff\">8</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">millisec</span> <span style=\"color:#f92672\">=</span> Date.<span style=\"color:#a6e22e\">now</span>();\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">timestamp</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">writeBigUint64BE</span>(<span style=\"color:#a6e22e\">millisec</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">payload</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Utf8</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">data</span>));\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">body</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">timestamp</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">nonce</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">payload</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">ivBuf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">iv</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">encryptedBody</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">AES</span>.<span style=\"color:#a6e22e\">encrypt</span>(\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">body</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">key</span>,\n</span></span><span style=\"display:flex;\"><span>      {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">iv</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">ivBuf</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">mode</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">mode</span>.<span style=\"color:#a6e22e\">GCM</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">padding</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">pad</span>.<span style=\"color:#a6e22e\">NoPadding</span>\n</span></span><span style=\"display:flex;\"><span>      }\n</span></span><span style=\"display:flex;\"><span>    );\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">ciphertext</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">encryptedBody</span>.<span style=\"color:#a6e22e\">ciphertext</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">authTag</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">mode</span>.<span style=\"color:#a6e22e\">GCM</span>.<span style=\"color:#a6e22e\">mac</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">algo</span>.<span style=\"color:#a6e22e\">AES</span>, <span style=\"color:#a6e22e\">key</span>, <span style=\"color:#a6e22e\">ivBuf</span>, <span style=\"color:#66d9ef\">null</span>, <span style=\"color:#a6e22e\">ciphertext</span>).<span style=\"color:#a6e22e\">toString</span>();\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">enveloped</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;01&#39;</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">iv</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">ciphertext</span>.<span style=\"color:#a6e22e\">toString</span>() <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">authTag</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">timestamp</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">timestamp</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">nonce</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">nonce</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">enveloped</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">enveloped</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>)\n</span></span><span style=\"display:flex;\"><span>    };\n</span></span><span style=\"display:flex;\"><span>  };\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">decrypt</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">data</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">data</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">iv</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">0</span>, <span style=\"color:#ae81ff\">24</span>));\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">ciphertext</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">24</span>, <span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">length</span> <span style=\"color:#f92672\">-</span> <span style=\"color:#ae81ff\">32</span>));\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">tag</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">length</span> <span style=\"color:#f92672\">-</span> <span style=\"color:#ae81ff\">32</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">encryptedBody</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">new</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">lib</span>.<span style=\"color:#a6e22e\">CipherParams</span>({ <span style=\"color:#a6e22e\">ciphertext</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">ciphertext</span> });\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">decrypted</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">AES</span>.<span style=\"color:#a6e22e\">decrypt</span>(<span style=\"color:#a6e22e\">encryptedBody</span>, <span style=\"color:#a6e22e\">key</span>, {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">iv</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">iv</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">mode</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">mode</span>.<span style=\"color:#a6e22e\">GCM</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">padding</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">pad</span>.<span style=\"color:#a6e22e\">NoPadding</span>\n</span></span><span style=\"display:flex;\"><span>    }).<span style=\"color:#a6e22e\">toString</span>();\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">timestamp</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypted</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">0</span>, <span style=\"color:#ae81ff\">16</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">nonce</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypted</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">16</span>, <span style=\"color:#ae81ff\">32</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">developed</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypted</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">32</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">timestamp</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">timestamp</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">nonce</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">nonce</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">developed</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">developed</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Utf8</span>))\n</span></span><span style=\"display:flex;\"><span>    };\n</span></span><span style=\"display:flex;\"><span>  };\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">payload</span> <span style=\"color:#f92672\">=</span> {};\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">email_hash</span>) <span style=\"color:#a6e22e\">payload</span>.<span style=\"color:#a6e22e\">email_hash</span> <span style=\"color:#f92672\">=</span> [<span style=\"color:#a6e22e\">email_hash</span>];\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">phone_hash</span>) <span style=\"color:#a6e22e\">payload</span>.<span style=\"color:#a6e22e\">phone_hash</span> <span style=\"color:#f92672\">=</span> [<span style=\"color:#a6e22e\">phone_hash</span>];\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> { <span style=\"color:#a6e22e\">timestamp</span>, <span style=\"color:#a6e22e\">nonce</span>, <span style=\"color:#a6e22e\">enveloped</span> } <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">encrypt</span>(<span style=\"color:#a6e22e\">payload</span>);\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">response</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">fetch</span>(<span style=\"color:#a6e22e\">url</span>, {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">method</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;POST&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">body</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">enveloped</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">headers</span><span style=\"color:#f92672\">:</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;Authorization&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">`Bearer </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">ttd_config</span>.<span style=\"color:#a6e22e\">api_key</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">`</span>\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  });\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">status</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#ae81ff\">200</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">body</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">text</span>();\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">data</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypt</span>(<span style=\"color:#a6e22e\">body</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// UID from email takes precedence. Modify as needed.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">uid_email</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">developed</span>.<span style=\"color:#a6e22e\">body</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">email_hash</span><span style=\"color:#f92672\">?</span>.[<span style=\"color:#ae81ff\">0</span>]<span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">u</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">uid_phone</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">developed</span>.<span style=\"color:#a6e22e\">body</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">phone_hash</span><span style=\"color:#f92672\">?</span>.[<span style=\"color:#ae81ff\">0</span>]<span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">u</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">uid2</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">uid_email</span> <span style=\"color:#f92672\">??</span> <span style=\"color:#a6e22e\">uid_phone</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// Tealium event is generated only if retrieved UID does not match existing visitor UID\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">uid2</span> <span style=\"color:#f92672\">&amp;&amp;</span> <span style=\"color:#a6e22e\">uid2</span> <span style=\"color:#f92672\">!==</span> <span style=\"color:#a6e22e\">current_uid</span>) {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">event_data</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">tealium_event</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;UID2_event_data&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">tealium_visitor_id</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">tealium_vid</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">uid</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">uid2</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">uid_timestamp</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">timestamp</span>)\n</span></span><span style=\"display:flex;\"><span>      };\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#75715e\">// Send the event_data object to Tealium for processing.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>      <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">track</span>(<span style=\"color:#a6e22e\">event_data</span>, <span style=\"color:#a6e22e\">tealium_config</span>)\n</span></span><span style=\"display:flex;\"><span>        .<span style=\"color:#a6e22e\">then</span>(<span style=\"color:#a6e22e\">response</span> =&gt; {\n</span></span><span style=\"display:flex;\"><span>          <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">ok</span>) {\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#66d9ef\">throw</span> <span style=\"color:#66d9ef\">new</span> Error(<span style=\"color:#e6db74\">`Track failed with status </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">status</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">`</span>);\n</span></span><span style=\"display:flex;\"><span>          }\n</span></span><span style=\"display:flex;\"><span>        })\n</span></span><span style=\"display:flex;\"><span>        .<span style=\"color:#66d9ef\">catch</span>(<span style=\"color:#a6e22e\">error</span> =&gt; <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#e6db74\">&#39;Error:&#39;</span>, <span style=\"color:#a6e22e\">error</span>.<span style=\"color:#a6e22e\">message</span>));\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  } <span style=\"color:#66d9ef\">else</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#e6db74\">`UID2 fetch failed: </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">status</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">`</span>);\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>});\n</span></span></code></pre></div>\n    </div>\n</div>\n</div>\n<p>The version three example returns a hashed UID2 for the email attribute in the following JSON structure:</p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-json\" data-lang=\"json\"><span style=\"display:flex;\"><span>{\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;body&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;email_hash&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>      {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;u&#34;</span>: <span style=\"color:#e6db74\">&#34;AdvIvSiaum0P5s3X/7X8h8sz+OhF2IG8DNbEnkWSbYM=&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;p&#34;</span>: <span style=\"color:#e6db74\">&#34;EObwtHBUqDNZR33LNSMdtt5cafsYFuGmuY4ZLenlue4=&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;r&#34;</span>: <span style=\"color:#ae81ff\">1735689600000</span>\n</span></span><span style=\"display:flex;\"><span>      },\n</span></span><span style=\"display:flex;\"><span>      {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;u&#34;</span>: <span style=\"color:#e6db74\">&#34;IbW4n6LIvtDj/8fCESlU0QG9K/fH63UdcTkJpAG8fIQ=&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;p&#34;</span>: <span style=\"color:#66d9ef\">null</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;r&#34;</span>: <span style=\"color:#ae81ff\">1735862400000</span>\n</span></span><span style=\"display:flex;\"><span>      }\n</span></span><span style=\"display:flex;\"><span>    ],\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;phone_hash&#34;</span>: []\n</span></span><span style=\"display:flex;\"><span>  },\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;status&#34;</span>: <span style=\"color:#e6db74\">&#34;success&#34;</span>\n</span></span><span style=\"display:flex;\"><span>}\n</span></span></code></pre></div><h3 id=\"version-2\">Version 2</h3>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>UID2 version 2 is deprecated on June 30, 2026. Update any existing UID2 version 2 functions to version 3.</p>\n<p>The version 2 example uses email addresses as the user identifier. Adapt it to use a different identifier, such as a phone number. An attribute ID is used to get the value of the email attribute. Update the attribute ID with the correct value for your attribute.</p>\n\n<div class=\"pv2\">\n<div class=\"expand ba pa2 b--black-20 pv3\">\n    <div class=\"expand-label\" style=\"cursor: pointer;\" onclick=\"$h = $(this);$h.next('div').slideToggle(100,function () {$h.children('i').attr('class',function () {return $h.next('div').is(':visible') ? 'fas fa-chevron-down' : 'fas fa-chevron-right';});});\">\n        <i style=\"font-size:x-small;\" class=\"fas fa-chevron-right\"></i>\n        <span style=\"font-weight:bold;\">\n        \n    \t\n    \tExpand to view code\n    \t\n    \t</span>\n    </div>\n    <div class=\"expand-content pa2\" style=\"display: none;\">\n        <div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-js\" data-lang=\"js\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">import</span> <span style=\"color:#a6e22e\">CryptoES</span> <span style=\"color:#a6e22e\">from</span> <span style=\"color:#e6db74\">&#39;crypto-es&#39;</span>\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">activate</span>(<span style=\"color:#66d9ef\">async</span> ({ <span style=\"color:#a6e22e\">visitor</span>, <span style=\"color:#a6e22e\">visit</span>, <span style=\"color:#a6e22e\">helper</span> }) =&gt; {  \n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">genHash</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">data</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">SHA256</span>(<span style=\"color:#a6e22e\">data</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>)\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">validateEmail</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">email</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> String(<span style=\"color:#a6e22e\">email</span>)\n</span></span><span style=\"display:flex;\"><span>      .<span style=\"color:#a6e22e\">toLowerCase</span>()\n</span></span><span style=\"display:flex;\"><span>      .<span style=\"color:#a6e22e\">match</span>(\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">/^(([^&lt;&gt;()[\\]\\\\.,;:\\s@&#34;]+(\\.[^&lt;&gt;()[\\]\\\\.,;:\\s@&#34;]+)*)|.(&#34;.+&#34;))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/</span>\n</span></span><span style=\"display:flex;\"><span>      );\n</span></span><span style=\"display:flex;\"><span>  };\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">tealium_config</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_account</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>, \n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_profile</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_datasource</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;DATA_SOURCE_KEY&#39;</span>, <span style=\"color:#75715e\">// TODO: Change DATA_SOURCE_KEY to your Tealium Data Source key.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#a6e22e\">email_hashed</span><span style=\"color:#f92672\">:</span> <span style=\"color:#66d9ef\">false</span> <span style=\"color:#75715e\">// TODO: If your email is already hashed, set this to true.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  };\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_account</span> <span style=\"color:#f92672\">==</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_account</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">properties</span>.<span style=\"color:#a6e22e\">account</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_profile</span> <span style=\"color:#f92672\">==</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_profile</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">properties</span>.<span style=\"color:#a6e22e\">profile</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">// TODO: Change the attribute_number to point to the attribute with the visitor&#39;s email\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">email</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">getAttributeValueById</span>(<span style=\"color:#e6db74\">&#39;ATTRIBUTE_ID&#39;</span>)\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">hashed_email</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">tealium_vid</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">properties</span>.<span style=\"color:#a6e22e\">visitor_id</span>\n</span></span><span style=\"display:flex;\"><span>  \n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">email_hashed</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">validateEmail</span>(<span style=\"color:#a6e22e\">email</span>)) {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#66d9ef\">throw</span> <span style=\"color:#66d9ef\">new</span> Error(<span style=\"color:#e6db74\">&#39;Email attribute is not a valid email&#39;</span>);\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">hashed_email</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">genHash</span>(<span style=\"color:#a6e22e\">email</span>)\n</span></span><span style=\"display:flex;\"><span>  } <span style=\"color:#66d9ef\">else</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">hashed_email</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">email</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">// TODO: Update the following variables with your TTD UID2 credentials\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">api_key</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;TTD_API_KEY&#39;</span> <span style=\"color:#75715e\">// TODO: Change TTD_API_KEY to your TTD API Key.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">secret</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;UID2_SECRET&#39;</span> <span style=\"color:#75715e\">// TODO: Change UID2_SECRET to your TTD UID2 secret.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">url</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;https://prod.uidapi.com/v2/identity/map&#39;</span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">key</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">secret</span>)\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">hexRef</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#34;0123456789abcdef&#34;</span>\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">randomBytes</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">bytes</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;&#39;</span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">for</span> (<span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#ae81ff\">0</span>; <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">&lt;</span> <span style=\"color:#a6e22e\">bytes</span> <span style=\"color:#f92672\">*</span> <span style=\"color:#ae81ff\">2</span>; <span style=\"color:#a6e22e\">i</span><span style=\"color:#f92672\">++</span>)\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">+=</span> <span style=\"color:#a6e22e\">hexRef</span>.<span style=\"color:#a6e22e\">charAt</span>(Math.<span style=\"color:#a6e22e\">floor</span>(Math.<span style=\"color:#a6e22e\">random</span>() <span style=\"color:#f92672\">*</span> <span style=\"color:#a6e22e\">hexRef</span>.<span style=\"color:#a6e22e\">length</span>))\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">buf</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">writeBigUint64BE</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">num</span>, <span style=\"color:#a6e22e\">bytes</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#ae81ff\">8</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">num</span>.<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#ae81ff\">16</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">padding</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;&#39;</span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">for</span> (<span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#ae81ff\">0</span>; <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">&lt;</span> <span style=\"color:#a6e22e\">bytes</span> <span style=\"color:#f92672\">*</span> <span style=\"color:#ae81ff\">2</span> <span style=\"color:#f92672\">-</span> <span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">length</span>; <span style=\"color:#a6e22e\">i</span><span style=\"color:#f92672\">++</span>)\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">padding</span> <span style=\"color:#f92672\">+=</span> <span style=\"color:#e6db74\">&#39;0&#39;</span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">padding</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">buf</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">encrypt</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">data</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">iv</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">randomBytes</span>(<span style=\"color:#ae81ff\">12</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">nonce</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">randomBytes</span>(<span style=\"color:#ae81ff\">8</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">millisec</span> <span style=\"color:#f92672\">=</span> Date.<span style=\"color:#a6e22e\">now</span>()\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">timestamp</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">writeBigUint64BE</span>(<span style=\"color:#a6e22e\">millisec</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">payload</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Utf8</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">data</span>))\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">body</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">timestamp</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">nonce</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">payload</span> \n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">ivBuf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">iv</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">encryptedBody</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">AES</span>.<span style=\"color:#a6e22e\">encrypt</span>(\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">body</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">key</span>,\n</span></span><span style=\"display:flex;\"><span>      {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">iv</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">ivBuf</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">mode</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">mode</span>.<span style=\"color:#a6e22e\">GCM</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">padding</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">pad</span>.<span style=\"color:#a6e22e\">NoPadding</span>\n</span></span><span style=\"display:flex;\"><span>      }\n</span></span><span style=\"display:flex;\"><span>    )\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">ciphertext</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">encryptedBody</span>.<span style=\"color:#a6e22e\">ciphertext</span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">authTag</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">mode</span>.<span style=\"color:#a6e22e\">GCM</span>.<span style=\"color:#a6e22e\">mac</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">algo</span>.<span style=\"color:#a6e22e\">AES</span>, <span style=\"color:#a6e22e\">key</span>, <span style=\"color:#a6e22e\">ivBuf</span>, <span style=\"color:#66d9ef\">null</span>, <span style=\"color:#a6e22e\">ciphertext</span>).<span style=\"color:#a6e22e\">toString</span>()\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">enveloped</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;01&#39;</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">iv</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">ciphertext</span>.<span style=\"color:#a6e22e\">toString</span>() <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">authTag</span>\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">timestamp</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">timestamp</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">nonce</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">nonce</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">enveloped</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">enveloped</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>)\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">decrypt</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">data</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">data</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">iv</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">0</span>, <span style=\"color:#ae81ff\">24</span>))\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">ciphertext</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">24</span>, <span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">length</span> <span style=\"color:#f92672\">-</span> <span style=\"color:#ae81ff\">32</span>))\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">tag</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">length</span> <span style=\"color:#f92672\">-</span> <span style=\"color:#ae81ff\">32</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">encryptedBody</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">new</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">lib</span>.<span style=\"color:#a6e22e\">CipherParams</span>({ <span style=\"color:#a6e22e\">ciphertext</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">ciphertext</span> })\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">decrypted</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">AES</span>.<span style=\"color:#a6e22e\">decrypt</span>(<span style=\"color:#a6e22e\">encryptedBody</span>, <span style=\"color:#a6e22e\">key</span>, \n</span></span><span style=\"display:flex;\"><span>      {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">iv</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">iv</span>, \n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">mode</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">mode</span>.<span style=\"color:#a6e22e\">GCM</span>, \n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">padding</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">pad</span>.<span style=\"color:#a6e22e\">NoPadding</span>\n</span></span><span style=\"display:flex;\"><span>      }\n</span></span><span style=\"display:flex;\"><span>    ).<span style=\"color:#a6e22e\">toString</span>()\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">timestamp</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypted</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">0</span>, <span style=\"color:#ae81ff\">16</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">nonce</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypted</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">16</span>, <span style=\"color:#ae81ff\">32</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">developed</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypted</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">32</span>)\n</span></span><span style=\"display:flex;\"><span>  \n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">timestamp</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">timestamp</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">nonce</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">nonce</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">developed</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">developed</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Utf8</span>))\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">payload</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">email_hash</span><span style=\"color:#f92672\">:</span> [<span style=\"color:#a6e22e\">hashed_email</span>]\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> {<span style=\"color:#a6e22e\">timestamp</span>, <span style=\"color:#a6e22e\">nonce</span>, <span style=\"color:#a6e22e\">enveloped</span>} <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">encrypt</span>(<span style=\"color:#a6e22e\">payload</span>)\n</span></span><span style=\"display:flex;\"><span>  \n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">response</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">fetch</span>(<span style=\"color:#a6e22e\">url</span>, {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">method</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;POST&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">body</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">enveloped</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">headers</span><span style=\"color:#f92672\">:</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;Authorization&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">`Bearer </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">api_key</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">`</span>\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  })\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">status</span> <span style=\"color:#f92672\">==</span> <span style=\"color:#ae81ff\">200</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">body</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">text</span>()\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">data</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypt</span>(<span style=\"color:#a6e22e\">body</span>)\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// This event spec is sent to Tealium at the end of the function. Make sure that the attributes in the event spec you created match the attributes in event_data.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">event_data</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">tealium_event</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;UID2_event_data&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">tealium_visitor_id</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">tealium_vid</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">uid</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">developed</span>.<span style=\"color:#a6e22e\">body</span>.<span style=\"color:#a6e22e\">mapped</span>[<span style=\"color:#ae81ff\">0</span>].<span style=\"color:#a6e22e\">advertising_id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">uid_timestamp</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">timestamp</span>)\n</span></span><span style=\"display:flex;\"><span>    };\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// Send the event_data object to Tealium for processing.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">event_data</span>.<span style=\"color:#a6e22e\">uid</span>) {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">track</span>(<span style=\"color:#a6e22e\">event_data</span>, <span style=\"color:#a6e22e\">tealium_config</span>)\n</span></span><span style=\"display:flex;\"><span>        .<span style=\"color:#a6e22e\">then</span>(<span style=\"color:#a6e22e\">response</span> =&gt; {\n</span></span><span style=\"display:flex;\"><span>          <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">ok</span>) {\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#66d9ef\">throw</span> <span style=\"color:#66d9ef\">new</span> Error(<span style=\"color:#e6db74\">`Network response was not ok. Status code: </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">status</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">.`</span>);\n</span></span><span style=\"display:flex;\"><span>          }\n</span></span><span style=\"display:flex;\"><span>          <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">text</span>();\n</span></span><span style=\"display:flex;\"><span>        })\n</span></span><span style=\"display:flex;\"><span>        .<span style=\"color:#66d9ef\">catch</span>(<span style=\"color:#a6e22e\">error</span> =&gt; <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#e6db74\">&#39;Error:&#39;</span>, <span style=\"color:#a6e22e\">error</span>.<span style=\"color:#a6e22e\">message</span>));\n</span></span><span style=\"display:flex;\"><span>    } <span style=\"color:#66d9ef\">else</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#e6db74\">&#34;Could not generate advertising ID&#34;</span>)\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  } <span style=\"color:#66d9ef\">else</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;UID2 fetch failed&#39;</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">response</span>))\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>})\n</span></span></code></pre></div>\n    </div>\n</div>\n</div>\n<p>The version two example returns a hashed UID2 for the email attribute in the following JSON structure:</p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-json\" data-lang=\"json\"><span style=\"display:flex;\"><span>{\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;body&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;mapped&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>      {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;identifier&#34;</span>: <span style=\"color:#e6db74\">&#34;EObwtHBUqDNZR33LNSMdtt5cafsYFuGmuY4ZLenlue4=&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;advertising_id&#34;</span>: <span style=\"color:#e6db74\">&#34;AdvIvSiaum0P5s3X/7X8h8sz+OhF2IG8DNbEnkWSbYM=&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;bucket_id&#34;</span>: <span style=\"color:#e6db74\">&#34;a30od4mNRd&#34;</span>\n</span></span><span style=\"display:flex;\"><span>      },\n</span></span><span style=\"display:flex;\"><span>      {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;identifier&#34;</span>: <span style=\"color:#e6db74\">&#34;Rx8SW4ZyKqbPypXmswDNuq0SPxStFXBTG/yvPns/2NQ=&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;advertising_id&#34;</span>: <span style=\"color:#e6db74\">&#34;IbW4n6LIvtDj/8fCESlU0QG9K/fH63UdcTkJpAG8fIQ=&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;bucket_id&#34;</span>: <span style=\"color:#e6db74\">&#34;ad1ANEmVZ&#34;</span>\n</span></span><span style=\"display:flex;\"><span>      }\n</span></span><span style=\"display:flex;\"><span>    ]\n</span></span><span style=\"display:flex;\"><span>  },\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;status&#34;</span>: <span style=\"color:#e6db74\">&#34;success&#34;</span>\n</span></span><span style=\"display:flex;\"><span>}\n</span></span></code></pre></div>"
        }  

    , 
        {
            "weight": "85",
            "url": "https://docs-preview.tealium.com/server-side/functions/event-visitor-functions/euid/",
            "title": "Use a function to generate an EUID",
            "body": "<p>European Unified ID (EUID) is an open source ID framework created by <a href=\"https://euid.eu/docs/intro\">The Trade Desk</a>, which can be used instead of a third-party cookie. EUID is a deterministic user identifier based on a user&rsquo;s Personally Identifiable Information (PII). EUID currently uses only the user&rsquo;s email address as an identifier and is limited to European regions. The identifier is hashed and encrypted to create an EUID that is returned in the response to an EUID request. For more information, see the <a href=\"https://euid.eu/docs/intro\">European Unified ID Overview</a>.</p>\n<p>An EUID can be used in <a href=\"/server-side-connectors/the-trade-desk-first-party-data-connector/\">The Trade Desk connector</a> and other supported outbound connectors.</p>\n<h2 id=\"generate-euid-for-a-visitor-profile\">Generate EUID for a visitor profile</h2>\n<p>We recommend using a visitor function to generate the EUID. Trigger the function when the visitor has PII but does not have an EUID assigned. For more information about visitor functions, see <a href=\"/server-side/functions/event-visitor-functions/about/\">About event and visitor functions</a>.</p>\n<p>The visitor function does the following:</p>\n<ul>\n<li>Capture the visitor’s email address and hash it.</li>\n<li>Uses the <a href=\"https://euid.eu/docs/endpoints/post-identity-map\">EUID endpoint</a> to generate an EUID if the visitor does not have one assigned.</li>\n<li>Sends an event containing the EUID and <code>tealium_visitor_id</code> to Tealium Collect.</li>\n</ul>\n<p>The visitor attribute is enriched by the event sent from the function.</p>\n<h3 id=\"prerequisites\">Prerequisites</h3>\n<p>Before you create a visitor function to generate an EUID, do the following:</p>\n<ul>\n<li>Choose a PII visitor attribute to use as an identifier for your users. EUID currently supports an email address identifier.</li>\n<li>Create a visitor attribute to store the EUID. Add an enrichment to enrich this visitor attribute with the value of the event EUID attribute. For more information, see <a href=\"/server-side/attributes/about/\">Using Attributes</a> and <a href=\"/server-side/attributes/enrichments/\">About enrichments</a>.</li>\n<li>Create an audience to identify visitors that have an email address assigned but do not have an EUID assigned. For example:<br>\n<figure><a class=\"slb\" href=\"/images/server-side/euid-function-trigger-example.png\"><img src=\"https://docs.tealium.com/images/server-side/euid-function-trigger-example.png\"\n         alt=\"euid-function-trigger-example.png\"\n         title=\"euid-function-trigger-example.png\"/>\n    </a>\n</figure><br>\nFor more information, see <a href=\"/server-side/audiences/manage/#create-an-audience\">Create an audience</a>.</li>\n</ul>\n<h2 id=\"euid-generator-function\">EUID generator function</h2>\n<p>When you create your function, do the following:</p>\n<ol>\n<li>For the trigger, select <strong>Processed Visitor</strong>.</li>\n<li>For <strong>Audience</strong>, select the audience you created for identified visitors that do not have an EUID assigned. Leave <strong>Trigger On</strong> set to the default value, which is <code>Joined Audience</code>.<br>\nDelete the default code for a processed visitor function, then copy and paste the example code to generate an EUID shown in <a href=\"#example-code\">Example code</a>. Modify the example code as needed.</li>\n</ol>\n<h3 id=\"example-code\">Example code</h3>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>This example code is only a guide for setting up a function to assign an EUID to visitors and <strong>cannot be used without modification</strong>. Look for comments in the code with <code>TODO</code> for the lines that must be modified for your configuration.</p>\n<p>This example uses an email address as the user identifier, but can be adapted to use other user identifiers. An attribute ID is used to get the value of the email attribute. Update the attribute ID with the correct value for the attribute you&rsquo;re using and place your EUID credentials in the appropriate locations (<code>api_key</code> and <code>secret</code>).</p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-js\" data-lang=\"js\"><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">import</span> <span style=\"color:#a6e22e\">CryptoES</span> <span style=\"color:#a6e22e\">from</span> <span style=\"color:#e6db74\">&#39;crypto-es&#39;</span>\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">activate</span>(<span style=\"color:#66d9ef\">async</span> ({ <span style=\"color:#a6e22e\">visitor</span>, <span style=\"color:#a6e22e\">visit</span>, <span style=\"color:#a6e22e\">helper</span> }) =&gt; {  \n</span></span><span style=\"display:flex;\"><span>  \n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">genHash</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">data</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">SHA256</span>(<span style=\"color:#a6e22e\">data</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>)\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">validateEmail</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">email</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> String(<span style=\"color:#a6e22e\">email</span>)\n</span></span><span style=\"display:flex;\"><span>      .<span style=\"color:#a6e22e\">toLowerCase</span>()\n</span></span><span style=\"display:flex;\"><span>      .<span style=\"color:#a6e22e\">match</span>(\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">/^(([^&lt;&gt;()[\\]\\\\.,;:\\s@&#34;]+(\\.[^&lt;&gt;()[\\]\\\\.,;:\\s@&#34;]+)*)|.(&#34;.+&#34;))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/</span>\n</span></span><span style=\"display:flex;\"><span>      );\n</span></span><span style=\"display:flex;\"><span>    };\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">tealium_config</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">tealium_account</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">tealium_profile</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">tealium_datasource</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;DATA_SOURCE_KEY&#39;</span>, <span style=\"color:#75715e\">// TODO: Change DATA_SOURCE_KEY to your Tealium Data Source key.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>      <span style=\"color:#a6e22e\">email_hashed</span><span style=\"color:#f92672\">:</span> <span style=\"color:#66d9ef\">false</span> <span style=\"color:#75715e\">// TODO: If your email is already hashed, set this to true.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    };\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span>(<span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_account</span> <span style=\"color:#f92672\">==</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_account</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">properties</span>.<span style=\"color:#a6e22e\">account</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span>(<span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_profile</span> <span style=\"color:#f92672\">==</span> <span style=\"color:#e6db74\">&#39;CURRENT&#39;</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">tealium_profile</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">properties</span>.<span style=\"color:#a6e22e\">profile</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">email</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">getAttributeValueById</span>(<span style=\"color:#e6db74\">&#34;ATTRIBUTE_ID&#34;</span>) <span style=\"color:#75715e\">// TODO: Change ATTRIBUTE_ID to the attribute ID of the user identifier attribute\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">email_hash</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#a6e22e\">email</span>)\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">tealium_vid</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">properties</span>.<span style=\"color:#a6e22e\">visitor_id</span>\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span>(<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">tealium_config</span>.<span style=\"color:#a6e22e\">email_hashed</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">if</span>(<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">validateEmail</span>(<span style=\"color:#a6e22e\">email</span>)) {\n</span></span><span style=\"display:flex;\"><span>       <span style=\"color:#66d9ef\">throw</span> <span style=\"color:#66d9ef\">new</span> Error(<span style=\"color:#e6db74\">`Email Attribute is not a valid email`</span>);\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#66d9ef\">return</span> <span style=\"color:#66d9ef\">false</span>\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">email_hash</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">genHash</span>(<span style=\"color:#a6e22e\">email</span>)\n</span></span><span style=\"display:flex;\"><span>  } <span style=\"color:#66d9ef\">else</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">email_hash</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">email</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#a6e22e\">email_hash</span>)\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">//Update the following variables with your TTD EUID credentials\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">api_key</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;api_key&#39;</span> <span style=\"color:#75715e\">// TODO: Change api_key to your assigned EUID API Key\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">secret</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;secret&#39;</span> <span style=\"color:#75715e\">// TODO: Change secret to your assigned EUID secret\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#75715e\">// const url = &#39;https://integ.euid.eu/v2/identity/map&#39; // Testing Environment (separate credentials are used). Only use for TESTING\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">url</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;https://prod.euid.eu/v2/identity/map&#39;</span>  <span style=\"color:#75715e\">// Production Environment\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">key</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">secret</span>)\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">hexRef</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#34;0123456789abcdef&#34;</span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">randomBytes</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">bytes</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;&#39;</span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">for</span> (<span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#ae81ff\">0</span>; <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">&lt;</span> <span style=\"color:#a6e22e\">bytes</span> <span style=\"color:#f92672\">*</span> <span style=\"color:#ae81ff\">2</span>; <span style=\"color:#a6e22e\">i</span><span style=\"color:#f92672\">++</span>)\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">+=</span> <span style=\"color:#a6e22e\">hexRef</span>.<span style=\"color:#a6e22e\">charAt</span>(Math.<span style=\"color:#a6e22e\">floor</span>(Math.<span style=\"color:#a6e22e\">random</span>() <span style=\"color:#f92672\">*</span> <span style=\"color:#a6e22e\">hexRef</span>.<span style=\"color:#a6e22e\">length</span>))\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">buf</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">writeBigUint64BE</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">num</span>, <span style=\"color:#a6e22e\">bytes</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#ae81ff\">8</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">num</span>.<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#ae81ff\">16</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">padding</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;&#39;</span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">for</span> (<span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#ae81ff\">0</span>; <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">&lt;</span> <span style=\"color:#a6e22e\">bytes</span> <span style=\"color:#f92672\">*</span> <span style=\"color:#ae81ff\">2</span> <span style=\"color:#f92672\">-</span> <span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">length</span>; <span style=\"color:#a6e22e\">i</span><span style=\"color:#f92672\">++</span>)\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">padding</span> <span style=\"color:#f92672\">+=</span> <span style=\"color:#e6db74\">&#39;0&#39;</span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">padding</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">buf</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">encrypt</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">data</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">iv</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">randomBytes</span>(<span style=\"color:#ae81ff\">12</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">nonce</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">randomBytes</span>(<span style=\"color:#ae81ff\">8</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">millisec</span> <span style=\"color:#f92672\">=</span> Date.<span style=\"color:#a6e22e\">now</span>()\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">timestamp</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">writeBigUint64BE</span>(<span style=\"color:#a6e22e\">millisec</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">payload</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Utf8</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">data</span>))\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">body</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">timestamp</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">nonce</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">payload</span> \n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">ivBuf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">iv</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">encryptedBody</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">AES</span>.<span style=\"color:#a6e22e\">encrypt</span>(\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">body</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">key</span>,\n</span></span><span style=\"display:flex;\"><span>      {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">iv</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">ivBuf</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">mode</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">mode</span>.<span style=\"color:#a6e22e\">GCM</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">padding</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">pad</span>.<span style=\"color:#a6e22e\">NoPadding</span>\n</span></span><span style=\"display:flex;\"><span>      }\n</span></span><span style=\"display:flex;\"><span>    )\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">ciphertext</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">encryptedBody</span>.<span style=\"color:#a6e22e\">ciphertext</span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">authTag</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">mode</span>.<span style=\"color:#a6e22e\">GCM</span>.<span style=\"color:#a6e22e\">mac</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">algo</span>.<span style=\"color:#a6e22e\">AES</span>, <span style=\"color:#a6e22e\">key</span>, <span style=\"color:#a6e22e\">ivBuf</span>, <span style=\"color:#66d9ef\">null</span>, <span style=\"color:#a6e22e\">ciphertext</span>).<span style=\"color:#a6e22e\">toString</span>()\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">enveloped</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;01&#39;</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">iv</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">ciphertext</span>.<span style=\"color:#a6e22e\">toString</span>() <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">authTag</span>\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">timestamp</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">timestamp</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">nonce</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">nonce</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">enveloped</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">enveloped</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>)\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">decrypt</span> <span style=\"color:#f92672\">=</span> (<span style=\"color:#a6e22e\">data</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">buf</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Base64</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">data</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">iv</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">0</span>, <span style=\"color:#ae81ff\">24</span>))\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">ciphertext</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">24</span>, <span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">length</span> <span style=\"color:#f92672\">-</span> <span style=\"color:#ae81ff\">32</span>))\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">tag</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#a6e22e\">buf</span>.<span style=\"color:#a6e22e\">length</span> <span style=\"color:#f92672\">-</span> <span style=\"color:#ae81ff\">32</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">encryptedBody</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">new</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">lib</span>.<span style=\"color:#a6e22e\">CipherParams</span>({ <span style=\"color:#a6e22e\">ciphertext</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">ciphertext</span> })\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">decrypted</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">AES</span>.<span style=\"color:#a6e22e\">decrypt</span>(<span style=\"color:#a6e22e\">encryptedBody</span>,<span style=\"color:#a6e22e\">key</span>, \n</span></span><span style=\"display:flex;\"><span>      {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">iv</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">iv</span>, \n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">mode</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">mode</span>.<span style=\"color:#a6e22e\">GCM</span>, \n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">padding</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">pad</span>.<span style=\"color:#a6e22e\">NoPadding</span>\n</span></span><span style=\"display:flex;\"><span>      }\n</span></span><span style=\"display:flex;\"><span>    ).<span style=\"color:#a6e22e\">toString</span>()\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">timestamp</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypted</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">0</span>, <span style=\"color:#ae81ff\">16</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">nonce</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypted</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">16</span>, <span style=\"color:#ae81ff\">32</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">developed</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypted</span>.<span style=\"color:#a6e22e\">substring</span>(<span style=\"color:#ae81ff\">32</span>)\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">//const tagCheck = CryptoES.mode.GCM.mac(CryptoES.AES, key, iv, null, ciphertext).toString()\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#75715e\">//console.log(&#39;\\nauthTag check:&#39;, tag == tagCheck)\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">timestamp</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">timestamp</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">nonce</span><span style=\"color:#f92672\">:</span> parseInt(<span style=\"color:#a6e22e\">nonce</span>, <span style=\"color:#ae81ff\">16</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">developed</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Hex</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">developed</span>).<span style=\"color:#a6e22e\">toString</span>(<span style=\"color:#a6e22e\">CryptoES</span>.<span style=\"color:#a6e22e\">enc</span>.<span style=\"color:#a6e22e\">Utf8</span>))\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">payload</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">email_hash</span><span style=\"color:#f92672\">:</span> [<span style=\"color:#a6e22e\">genHash</span>(<span style=\"color:#a6e22e\">email</span>)]\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> {<span style=\"color:#a6e22e\">timestamp</span>, <span style=\"color:#a6e22e\">nonce</span>, <span style=\"color:#a6e22e\">enveloped</span>} <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">encrypt</span>(<span style=\"color:#a6e22e\">payload</span>)\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;\\n********** encypted **********&#39;</span>)\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;timestamp:&#39;</span>, <span style=\"color:#a6e22e\">timestamp</span>)\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;nonce:&#39;</span>, <span style=\"color:#a6e22e\">nonce</span>)\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;enveloped:&#39;</span>, <span style=\"color:#a6e22e\">enveloped</span>)\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">response</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">fetch</span>(<span style=\"color:#a6e22e\">url</span>, {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">method</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;POST&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">body</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">enveloped</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">headers</span><span style=\"color:#f92672\">:</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;Authorization&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">`Bearer </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">api_key</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">`</span>\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  })\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">status</span> <span style=\"color:#f92672\">==</span> <span style=\"color:#ae81ff\">200</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">body</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">text</span>()\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;\\n********** response **********&#39;</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#a6e22e\">body</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">data</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">decrypt</span>(<span style=\"color:#a6e22e\">body</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;\\n********** decrypted **********&#39;</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;timeStamp:&#39;</span>, <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">timestamp</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;nonce:&#39;</span>, <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">nonce</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;response:&#39;</span>, <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">developed</span>))\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;\\n&#39;</span>)\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span> <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">event_data</span> <span style=\"color:#f92672\">=</span>{\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">tealium_event</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;euid_event&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">tealium_visitor_id</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">tealium_vid</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">euid_hashed_email</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">developed</span>.<span style=\"color:#a6e22e\">body</span>.<span style=\"color:#a6e22e\">mapped</span>[<span style=\"color:#ae81ff\">0</span>].<span style=\"color:#a6e22e\">identifier</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">euid_bucket_id</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">developed</span>.<span style=\"color:#a6e22e\">body</span>.<span style=\"color:#a6e22e\">mapped</span>[<span style=\"color:#ae81ff\">0</span>].<span style=\"color:#a6e22e\">bucket_id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">euid_raw</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">developed</span>.<span style=\"color:#a6e22e\">body</span>.<span style=\"color:#a6e22e\">mapped</span>[<span style=\"color:#ae81ff\">0</span>].<span style=\"color:#a6e22e\">advertising_id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">euid_timestamp</span> <span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">timestamp</span>),\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">euid_nonce</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">nonce</span>)\n</span></span><span style=\"display:flex;\"><span>    };\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">event_data</span>))\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">if</span>(<span style=\"color:#a6e22e\">event_data</span>.<span style=\"color:#a6e22e\">euid_raw</span>) {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">track</span>(<span style=\"color:#a6e22e\">event_data</span>, <span style=\"color:#a6e22e\">tealium_config</span>)\n</span></span><span style=\"display:flex;\"><span>          .<span style=\"color:#a6e22e\">then</span>(<span style=\"color:#a6e22e\">response</span> =&gt; {\n</span></span><span style=\"display:flex;\"><span>              <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">ok</span>) {\n</span></span><span style=\"display:flex;\"><span>                  <span style=\"color:#66d9ef\">throw</span> <span style=\"color:#66d9ef\">new</span> Error(<span style=\"color:#e6db74\">`Network response was not ok. Status code: </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">status</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">.`</span>);\n</span></span><span style=\"display:flex;\"><span>              }\n</span></span><span style=\"display:flex;\"><span>              <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;Status code:&#39;</span>, <span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">status</span>);\n</span></span><span style=\"display:flex;\"><span>              <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">text</span>();\n</span></span><span style=\"display:flex;\"><span>          })\n</span></span><span style=\"display:flex;\"><span>          .<span style=\"color:#66d9ef\">catch</span>(<span style=\"color:#a6e22e\">error</span> =&gt; <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#e6db74\">&#39;Error:&#39;</span>, <span style=\"color:#a6e22e\">error</span>.<span style=\"color:#a6e22e\">message</span>));\n</span></span><span style=\"display:flex;\"><span>    } \n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">else</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#e6db74\">&#34;Couldn&#39;t generate advertising ID&#34;</span>)\n</span></span><span style=\"display:flex;\"><span>      }\n</span></span><span style=\"display:flex;\"><span>  } \n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">else</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;\\nxxxxx  failed  xxxxx\\n&#39;</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">response</span>))\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>  })\n</span></span></code></pre></div>"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/client-side-tags/neustar-idmp-site-activity-tag/",
            "title": "Neustar IDMP Site Activity Tag Setup Guide",
            "body": "<p>Use the Neustar IDMP Site Activity tag to track user behavior on your websites, such as conversion events.</p>\n<h2 id=\"tag-tips\">Tag tips</h2>\n<ul>\n<li>Select the <strong>Pixel Type</strong> in the tag configuration to load the correct script type.</li>\n<li>Use mappings to override and dynamically set the tag configurations.</li>\n</ul>\n<h2 id=\"tag-configuration\">Tag configuration</h2>\n<p>Go to the tag marketplace to add a new tag. For more information about how to add a tag, see <a href=\"/iq-tag-management/tags/manage/\">Manage tags</a>.</p>\n<p>When adding the tag, configure the following settings:</p>\n<ul>\n<li><strong>Neustar Tag ID</strong>: The numerical value of your Neustar IDMP tag.</li>\n<li><strong>Pixel Type</strong>: Choose between generating an image or an iframe tag type.</li>\n</ul>\n<h2 id=\"load-rules\">Load rules</h2>\n<p>Load the tag on all pages or set conditions for when your tag will load. For more information, see <a href=\"/iq-tag-management/load-rules/about/\">About load rules</a>.</p>\n<h2 id=\"data-mappings\">Data mappings</h2>\n<p>Mapping is the process of sending data from a data layer variable to the corresponding destination variable of the vendor tag. For more information, see <a href=\"/iq-tag-management/data-mappings/about/\">About data mappings</a>.</p>\n<p>The available categories are:</p>\n<h3 id=\"configuration\">Configuration</h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Variable</th>\n<th style=\"text-align:left\">Type</th>\n<th style=\"text-align:left\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><code>pixelId</code></td>\n<td style=\"text-align:left\">String</td>\n<td style=\"text-align:left\">Pixel ID</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>pixelType</code></td>\n<td style=\"text-align:left\">String</td>\n<td style=\"text-align:left\">Pixel type</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"standard\">Standard</h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Variable</th>\n<th style=\"text-align:left\">Type</th>\n<th style=\"text-align:left\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><code>che</code></td>\n<td style=\"text-align:left\">String</td>\n<td style=\"text-align:left\">Cache buster</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>rev</code></td>\n<td style=\"text-align:left\">Number</td>\n<td style=\"text-align:left\">Revenue</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>cur</code></td>\n<td style=\"text-align:left\">String</td>\n<td style=\"text-align:left\">Currency code</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>qty</code></td>\n<td style=\"text-align:left\">Number</td>\n<td style=\"text-align:left\">Order count</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>type</code></td>\n<td style=\"text-align:left\">String</td>\n<td style=\"text-align:left\">Type</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>ord</code></td>\n<td style=\"text-align:left\">String</td>\n<td style=\"text-align:left\">Order ID</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>uid</code></td>\n<td style=\"text-align:left\">String</td>\n<td style=\"text-align:left\">Third-party user ID</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>dedup</code></td>\n<td style=\"text-align:left\">String</td>\n<td style=\"text-align:left\">Deduplication ID</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>ip</code></td>\n<td style=\"text-align:left\">String</td>\n<td style=\"text-align:left\">IP Address</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/client-side-tags/neustar-real-user-measurement-tag/",
            "title": "Neustar (Real User Measurement) tag",
            "body": "<p>Neustar (RUM), Inc. is a trusted, neutral provider of real-time information and analysis to the internet, telecommunications, information services, financial services, retail, media and advertising sectors.</p>\n<h2 id=\"tag-tips\">Tag tips</h2>\n<ul>\n<li>Add the following code to a PreLoader extension for more accurate metrics:</li>\n</ul>\n<pre tabindex=\"0\"><code>window.t_pagestart = new Date().getTime();\n</code></pre><ul>\n<li>Recommended that this tag runs first (move to top of tags list)</li>\n<li>This tag should be set to <code>Wait=Yes</code> (default)</li>\n<li>No tag configuration needed</li>\n</ul>\n<h2 id=\"tag-configuration\">Tag configuration</h2>\n<p>Go to the tag marketplace to add a new tag. For more information about how to add a tag, see <a href=\"/iq-tag-management/tags/manage/\">Manage tags</a>.</p>\n<p>When adding the tag, configure the following settings:</p>\n<ul>\n<li><strong>Account ID</strong>: The account ID.</li>\n<li><strong>Time Out Value</strong>: Set the amount of time before the tag times out.</li>\n<li><strong>Run Init at Tag load</strong>: Run init process when the tag loads. Cannot be mapped.</li>\n</ul>\n<h2 id=\"load-rules\">Load rules</h2>\n<p>Load the tag on all pages or set conditions for when your tag will load. For more information, see <a href=\"/iq-tag-management/load-rules/about/\">About load rules</a>.</p>\n<h2 id=\"data-mappings\">Data mappings</h2>\n<p>Mapping is the process of sending data from a data layer variable to the corresponding destination variable of the vendor tag. For more information, see <a href=\"/iq-tag-management/data-mappings/about/\">About data mappings</a>.</p>\n<p>The available categories are:</p>\n<h3 id=\"standard\">Standard</h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Description</th>\n<th style=\"text-align:left\">Variable</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><code>account</code></td>\n<td style=\"text-align:left\">Account ID</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>time_out</code></td>\n<td style=\"text-align:left\">Perceived load timeout</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/client-side-tags/neustar-pageadvisor-tag/",
            "title": "Neustar PageAdvisor Tag Setup Guide",
            "body": "<h2 id=\"tag-tips\">Tag tips</h2>\n<ul>\n<li>Use mapping to override the standard configuration values dynamically.</li>\n<li>Use custom variables to assign dynamic values.</li>\n</ul>\n<h2 id=\"tag-configuration\">Tag configuration</h2>\n<p>Go to the tag marketplace to add a new tag. For more information about how to add a tag, see <a href=\"/iq-tag-management/tags/manage/\">Manage tags</a>.</p>\n<p>When adding the tag, configure the following settings:</p>\n<ul>\n<li><strong>Service ID (sid)</strong>: A 10-digit numeric value that allows Neustar to identify the client (for example, <code>9876543210</code>).</li>\n<li><strong>Page Reference (page)</strong>: A reference used by the client to indicate which page a user is on (for example, <code>http://www.neustar.biz</code>).</li>\n</ul>\n<h2 id=\"load-rules\">Load rules</h2>\n<p>Load the tag on all pages or set conditions for when your tag will load. For more information, see <a href=\"/iq-tag-management/load-rules/about/\">About load rules</a>.</p>\n<h2 id=\"data-mappings\">Data mappings</h2>\n<p>Mapping is the process of sending data from a data layer variable to the corresponding destination variable of the vendor tag. For more information, see <a href=\"/iq-tag-management/data-mappings/about/\">About data mappings</a>.</p>\n<p>The available categories are:</p>\n<h3 id=\"standard\">Standard</h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Variable</th>\n<th style=\"text-align:left\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><code>service_id</code></td>\n<td style=\"text-align:left\">Service ID</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>page_ref</code></td>\n<td style=\"text-align:left\">Page reference</td>\n</tr>\n<tr>\n<td style=\"text-align:left\"><code>cv1</code></td>\n<td style=\"text-align:left\">Custom variable</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/client-side-tags/acxiom-real-identity-rtag/",
            "title": "Acxiom Real Identity rTag Setup Guide",
            "body": "<p>rTAG provides the ability to flexibly instrument digital channels with data collection capabilities, identity generation and association, privacy governance and containers for managing invocation of partner tags.</p>\n<h2 id=\"tag-tips\">Tag Tips</h2>\n<ul>\n<li>Use mappings to override or dynamically set the tag configurations.</li>\n</ul>\n<h2 id=\"tag-configuration\">Tag Configuration</h2>\n<p>Go to the tag marketplace to add a new tag. For more information about how to add a tag, see <a href=\"/iq-tag-management/tags/manage/\">Manage tags</a>.</p>\n<p>When adding the tag, configure the following settings:</p>\n<ul>\n<li><strong>Domain Name</strong>: A subdomain of the client’s domain name with a CNAME that much be changed to rTAG.</li>\n<li><strong>ESI toggle</strong>: (Optional) Top level directory indicates whether ESI is enabled.\n<ul>\n<li><strong>1</strong> — Indicates files are processed for ESI directly.</li>\n<li><strong>2</strong> — Indicates that ESI files are gzipped and cached after being generated.</li>\n</ul>\n</li>\n<li><strong>Logging Mode</strong>: Logging mode based on the logging requirements of the client.</li>\n<li><strong>Tag Type</strong>: The filename of the object to be received.</li>\n</ul>\n<h2 id=\"load-rules\">Load Rules</h2>\n<p>Load the tag on all pages or set conditions for when your tag will load. For more information about load rules, see the <a href=\"/iq-tag-management/load-rules/about/\">Load Rules</a> documentation.</p>\n<h2 id=\"data-mappings\">Data Mappings</h2>\n<p>Mapping is the process of sending data from a data layer variable to the corresponding destination variable of the vendor tag. For instructions on how to map a variable to a tag destination, see <a href=\"/iq-tag-management/data-mappings/manage/\">data mappings</a>.</p>\n<p>The available categories are:</p>\n<h3 id=\"tag-configuration-1\">Tag Configuration</h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Variable</th>\n<th style=\"text-align:left\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\">Domain name (<code>domain_name</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">ESI toggle (<code>esi_toggle</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Logging mode (<code>logging_mode</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Tag type (<code>tag_type</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"standard\">Standard</h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Variable</th>\n<th style=\"text-align:left\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\">Cache buster, typically set to a random number or timestamp (<code>r</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Encoded URL destination for a 302-redirect directive (<code>ru</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Event ID (<code>evid</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Session ID (<code>s</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Domain (<code>dmn</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Path with filename (<code>pn</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Query string of the URL (<code>qs</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Domain of the referring page (<code>rdn</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Path with filename of referring page (<code>rpn</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Query string of the URL of referring page (<code>rqs</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Unique user agent/user/browser identifier, which can be from a cookie, a statistical ID, or other source (<code>uu</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Statistical id (<code>suu</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">The specific class tag configuration to be used (<code>cls</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Publisher or site identifier (<code>pubid</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Partner unique identifier (<code>puu</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Payload passed by client in clientObject (<code>payload</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Advertising agency identifier (<code>ag</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Advertiser or marketer identifier (<code>adv</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Campaign identifier (<code>ca</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Creative identifier (<code>cr</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">List of user segments (<code>sg</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Comma separated list of entity types (<code>aqet</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Client-determined variable 0 (<code>v0</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Client-determined variable 1 (<code>v1</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Client-determined variable 2 (<code>v2</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Client-determined variable 3 (<code>v3</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Client-determined variable 4 (<code>v4</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Client-determined variable 5 (<code>v5</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Client-determined variable 6 (<code>v6</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Client-determined variable 7 (<code>v7</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Client-determined variable 8 (<code>v8</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Client-determined variable 9 (<code>v9</code>)</td>\n<td style=\"text-align:left\">[String]</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/client-side-tags/epsilon-partner-sync-web-service-tag/",
            "title": "Epsilon Partner Sync Web Service Tag Setup Guide",
            "body": "<p>Epsilon is the leader in outcome-based marketing with a rich, 50-year heritage in helping marketers anticipate, activate, and prove measurable business outcomes.</p>\n<h2 id=\"tag-configuration\">Tag Configuration</h2>\n<p>First, go to the tag marketplace and add the Epsilon Partner Sync Web Service tag (Learn more about <a href=\"/iq-tag-management/tags/manage/\">how to add a tag</a>).</p>\n<p>After adding the tag, configure the following settings:</p>\n<ul>\n<li><strong>Advertiser Identifier</strong>: <code>dtm_cid</code></li>\n<li><strong>Secondary Advertiser Identifier</strong>: <code>dtm_cmagic</code></li>\n<li><strong>Page Visit Form ID</strong>: <code>dtm_fid</code></li>\n</ul>\n<h2 id=\"data-mappings\">Data Mappings</h2>\n<p>Mapping is the process of sending data from a <a href=\"/iq-tag-management/data-layer/data-layer-variables/\">data layer variable</a> to the corresponding destination variable of the vendor tag. For instructions on how to map a variable to a tag destination, see <a href=\"/iq-tag-management/data-mappings/manage/\">data mappings</a>.</p>\n<p>The available categories are:</p>\n<h3 id=\"tag-configuration-1\">Tag Configuration</h3>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Data Type</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>dtm_cid</code></td>\n<td>String</td>\n<td>Company ID</td>\n</tr>\n<tr>\n<td><code>dtm_cmagic</code></td>\n<td>String</td>\n<td>Secondary Company ID</td>\n</tr>\n<tr>\n<td><code>dtm_fid</code></td>\n<td>String</td>\n<td>Form ID</td>\n</tr>\n<tr>\n<td><code>dtm_cookie_id</code></td>\n<td>String</td>\n<td>Cookie ID</td>\n</tr>\n<tr>\n<td><code>dtm_user_id</code></td>\n<td>String</td>\n<td>User ID</td>\n</tr>\n<tr>\n<td><code>dtm_token_sc</code></td>\n<td>String</td>\n<td>dtm_token_sc</td>\n</tr>\n<tr>\n<td><code>dtmc_tcf_string</code></td>\n<td>String</td>\n<td>dtmc_tcf_string</td>\n</tr>\n<tr>\n<td><code>cachebuster</code></td>\n<td>String</td>\n<td>Cache Buster</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/server-side-connectors/criteo-audiences-connector/",
            "title": "Criteo Audiences Connector Setup Guide",
            "body": "<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>We reccomend that you use the <a href=\"/server-side-connectors/criteo-audiences-oauth-connector/\">Criteo Audiences (OAuth) connector</a> to send visitor data to Criteo. The OAuth connector uses your Criteo account credentials and the Authorization Code flow for improved security, privacy, and easier account management.</p>\n<h2 id=\"connector-actions\">Connector actions</h2>\n<table>\n<thead>\n<tr>\n<th>Action Name</th>\n<th style=\"text-align:center\">AudienceStream</th>\n<th style=\"text-align:center\">EventStream</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Add User to Audience</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✓</td>\n</tr>\n<tr>\n<td>Remove User from Audience</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✓</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"api-information\">API information</h3>\n<p>This connector uses the following vendor API:</p>\n<ul>\n<li>API Name: Criteo API</li>\n<li>API Version: 2025-07</li>\n<li>API Endpoint: <code>https://api.criteo.com/2025-07/audiences</code></li>\n<li>Documentation: <a href=\"https://developers.criteo.com/marketing-solutions/docs/audiences\">Criteo: Audiences API</a></li>\n</ul>\n<h3 id=\"batch-limits\">Batch limits</h3>\n<p>This connector uses batched requests to support high-volume data transfers to the vendor. For more information, see <a href=\"/server-side/connectors/batched-actions/\">Batched Actions</a>. Requests are queued until one of the following thresholds is met or the profile is published:</p>\n<ul>\n<li>Max number of requests: 50000</li>\n<li>Max time since oldest request: 15 minutes</li>\n<li>Max size of requests: 10 MB</li>\n</ul>\n<h2 id=\"configure-settings\">Configure settings</h2>\n<h3 id=\"request-consent-link-from-criteo\">Request Consent Link from Criteo</h3>\n<p>If you intend to use this connector, send an email to <a href=\"mailto:asintegrations@tealium.com\">asintegrations@tealium.com</a> to receive a consent link that authorizes the Tealium Customer Data Hub to manage audiences on behalf of advertisers. For more information, see <a href=\"https://developers.criteo.com/marketing-solutions/docs/authorization-requests\">Criteo Developers: Send an Authorization Request to Your Users</a>.</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>This step may take up to three working days for approval.</p>\n<p>After receiving the Criteo activation link, complete the following steps:</p>\n<ol>\n<li>Click the activation link provided.<br>\nThe <strong>Criteo Consent Portal</strong> appears.</li>\n<li>Grant the requested authorization levels for the account.</li>\n</ol>\n<h3 id=\"add-connector-and-configure-settings\">Add Connector and Configure Settings</h3>\n<p>Go to the Connector Marketplace and add the Criteo Audiences connector to your profile. For general instructions on how to add a connector, see <a href=\"/server-side/connectors/about/\">Connector Overview</a>.</p>\n<p>After adding the connector, configure the following settings:</p>\n<ul>\n<li><strong>Advertiser ID (Required)</strong><br>\nConfigure the <strong>Advertiser ID</strong> associated with an integration in your Criteo account.</li>\n</ul>\n<h2 id=\"action-settings---parameters-and-options\">Action Settings - Parameters and Options</h2>\n<p>Click <strong>Next</strong> or go to the <strong>Actions</strong> tab. This is where you configure connector actions.</p>\n<p>This section describes how to set up parameters and options for each action.</p>\n<h3 id=\"action---add-user-to-audience\">Action - Add User to Audience</h3>\n<h4 id=\"parameters\">Parameters</h4>\n<table>\n<thead>\n<tr>\n<th><strong>Parameter</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Audience</td>\n<td>Select an audience or enter the Audience ID to add the user to.</td>\n</tr>\n<tr>\n<td>Identifier</td>\n<td>Map a user identifier value. <ul><li><strong>Email</strong>: Send email value as-is without applying built-in hashing. Select this option if the value requires no hashing or is already hashed.</li><li><strong>Email (apply MD5 hash)</strong>: Hash email value with MD5 before sending.</li><li><strong>Email (apply MD5 SHA256 hash)</strong>: Hash email value with MD5 and then SHA256 before sending.</li><li><strong>Mobile ID</strong>: IDFA mobile ID for Apple, ADID mobile ID for Android.</li><li><strong>Identity Link</strong>: Identity Link</li><li><strong>Gum ID</strong>: Identifier obtained from cookie matching. A corresponding Gum Caller ID is automatically added to the request.</li></ul></td>\n</tr>\n<tr>\n<td>Gum Caller ID</td>\n<td>Gum Caller <code>ID</code> - Value used by Criteo for <code>GUM</code> (Generative Unified Media) salting. If using the Tealium iQ Criteo Cookie Matching Service tag, leave this unmapped.</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"action---remove-user-from-audience\">Action - Remove User from Audience</h3>\n<h4 id=\"parameters-1\">Parameters</h4>\n<table>\n<thead>\n<tr>\n<th><strong>Parameter</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Audience</td>\n<td>Select an audience or enter the Audience ID to remove the user from.</td>\n</tr>\n<tr>\n<td>Identifier</td>\n<td>Map a user identifier value. <ul><li><strong>Email</strong>: Send email value as-is without applying built-in hashing. Select this option if the value requires no hashing or is already hashed.</li><li><strong>Email (apply MD5 hash)</strong>: Hash email value with MD5 before sending.</li><li><strong>Email (apply MD5 SHA256 hash)</strong>: Hash email value with MD5 and then SHA256 before sending.</li><li><strong>Mobile ID</strong>: IDFA mobile ID for Apple, ADID mobile ID for Android.</li><li><strong>Identity Link</strong>: Identity Link</li><li><strong>Gum ID</strong>: Identifier obtained from cookie matching. A corresponding Gum Caller ID is automatically added to the request.</li></ul></td>\n</tr>\n<tr>\n<td>Gum Caller ID</td>\n<td>Gum Caller <code>ID</code> - Value used by Criteo for <code>GUM</code> salting. If using the Tealium iQ Criteo Cookie Matching Service tag, leave this unmapped.</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/client-side-tags/criteo-cookie-matching-service-tag/",
            "title": "Criteo Cookie Matching Service Tag Setup Guide",
            "body": "<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>When using this tag with <code>utag</code> version 4.50 or later, you must set the <code>utag.js</code> <a href=\"/platforms/javascript/settings/#always_set_v_id\"><code>always_set_v_id</code> setting</a> to <code>true</code>. This setting ensures that the visitor ID is available for cookie synchronization. For more information, see the <a href=\"/platforms/javascript/version-4-50/#updating-to-version-450-or-later\">utag 4.50 release notes</a> and <a href=\"https://support.tealiumiq.com/en/support/solutions/articles/36000535887-considerations-for-tealium-visitor-id-when-upgrading-to-utag-4-50-\">Considerations for tealium_visitor_id when upgrading to utag 4.50+</a>.</p>\n<p>Criteo Cookie Matching Service enables a buyer to associate the cookie that identifies a Tealium visitor, and the cookie that identifies the user for Criteo.</p>\n<h2 id=\"tag-tips\">Tag Tips</h2>\n<ul>\n<li>If left blank, Tealium Account and Profile will be automatically populated.</li>\n<li>Sends the following server-side attribute back to Tealium:\n<ul>\n<li><code>criteo_user_id</code></li>\n</ul>\n</li>\n</ul>\n<p>For more information about cookie matching in EventStream, see: <a href=\"/iq-tag-management/tags/cookie-matching/\">Understanding Persistent Cookie Matching in EventStream</a>.</p>\n<h2 id=\"tag-configuration\">Tag Configuration</h2>\n<p>Go to the tag marketplace to add a new tag. For more information about how to add a tag, see <a href=\"/iq-tag-management/tags/manage/\">Manage tags</a>.</p>\n<p>When adding the tag, configure the following settings:</p>\n<ul>\n<li><strong>Tealium Account</strong>: (Optional) Your Tealium account.</li>\n<li><strong>Tealium Profile</strong>: (Optional) Your Tealium profile.</li>\n<li><strong>Days between syncs</strong>: (Optional) How often to recheck the ID. This value defaults to 7 days.</li>\n<li><strong>Data Source Key</strong>: (Optional) The data source key from your server-side configuration.</li>\n<li><strong>Use <code>/event</code> endpoint</strong>: Send data to the <code>/event</code> endpoint.</li>\n</ul>\n<h2 id=\"load-rules\">Load Rules</h2>\n<p>Load the tag on all pages or set conditions for when your tag will load. For more information about load rules, see the <a href=\"/iq-tag-management/load-rules/about/\">Load Rules</a> documentation.</p>\n<h2 id=\"data-mappings\">Data Mappings</h2>\n<p>Mapping is the process of sending data from a data layer variable to the corresponding destination variable of the vendor tag. For instructions on how to map a variable to a tag destination, see <a href=\"/iq-tag-management/data-mappings/manage/\">data mappings</a>.</p>\n<p>The available categories are:</p>\n<h3 id=\"standard\">Standard</h3>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Tealium Account (<code>tealium_account</code>)</td>\n<td>[String]</td>\n</tr>\n<tr>\n<td>Tealium Profile (<code>tealium_profile</code>)</td>\n<td>[String]</td>\n</tr>\n<tr>\n<td>Days between syncs (<code>days_between_syncs</code>)</td>\n<td>[Number]</td>\n</tr>\n<tr>\n<td>Data Source Key (<code>tealium_datasource</code>)</td>\n<td>[String]</td>\n</tr>\n<tr>\n<td>Use <code>/event</code> endpoint (<code>use_event_endpoint</code>)</td>\n<td>[Boolean]</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/client-side-tags/merkle-merkury-tag/",
            "title": "Merkle Merkury Tag Setup Guide",
            "body": "<h2 id=\"tag-tips\">Tag Tips</h2>\n<ul>\n<li>Adobe MediaSDK requires the Adobe Experience Cloud ID Service as well as AppMeasurement for JS to be loaded first, preferably bundled.</li>\n<li>This tag is fired through <code>utag.track('video', data);</code> which should be implemented in your video event handlers.</li>\n</ul>\n<h2 id=\"tag-configuration\">Tag Configuration</h2>\n<p>Go to the tag marketplace to add a new tag. For more information about how to add a tag, see <a href=\"/iq-tag-management/tags/manage/\">Manage tags</a>.</p>\n<p>When adding the tag, configure the following settings:</p>\n<ul>\n<li><strong>CID</strong><br>\nA client-specific numeric account number generated from Merkury Team.</li>\n<li><strong>Domain</strong><br>\nThe client website&rsquo;s domain. For example: <code>merkleinc.com</code>.</li>\n<li><strong>Send Merkury Identity Event</strong><br>\nWhether to generate the <code>merkury_identity</code> event, which contains the following information:\n<ul>\n<li><code>event</code></li>\n<li><code>merkury_email_sha256</code></li>\n<li><code>merkury_hmid</code></li>\n<li><code>merkury_confidence_score</code></li>\n</ul>\n</li>\n</ul>\n<h2 id=\"load-rules\">Load Rules</h2>\n<p>Load the tag on all pages or set conditions for when your tag will load. For more information about load rules, see the <a href=\"/iq-tag-management/load-rules/about/\">Load Rules</a> documentation.</p>\n<h2 id=\"data-mappings\">Data Mappings</h2>\n<p>Mapping is the process of sending data from a data layer variable to the corresponding destination variable of the vendor tag. For instructions on how to map a variable to a tag destination, see <a href=\"/iq-tag-management/data-mappings/manage/\">data mappings</a>.</p>\n<p>The available categories are:</p>\n<h3 id=\"standard\">Standard</h3>\n<table>\n<thead>\n<tr>\n<th>Description</th>\n<th>Variable</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>sv_cid</code></td>\n<td>CID</td>\n</tr>\n<tr>\n<td><code>sv_origin</code></td>\n<td>Domain</td>\n</tr>\n<tr>\n<td><code>uID</code></td>\n<td>Client ID</td>\n</tr>\n<tr>\n<td><code>em</code></td>\n<td>Email address</td>\n</tr>\n<tr>\n<td><code>eme</code></td>\n<td>MD5 email hash</td>\n</tr>\n<tr>\n<td><code>emID</code></td>\n<td>Client email ID</td>\n</tr>\n<tr>\n<td><code>base_url</code></td>\n<td>Base URL</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/industries/tealium-identity-partners/netid-identity-resolution/",
            "title": "netID Implementation Guide",
            "body": "<p>First-party data, such as a netID, is crucial for accurate retargeting and personalization. The Tealium real-time first-party data platform helps activate these identifiers across channels, enhancing the effectiveness of advertising campaigns.</p>\n<h2 id=\"prerequisites\">Prerequisites</h2>\n<ul>\n<li>A request to the netID browser-based JavaScript API</li>\n<li>Tealium EventStream or AudienceStream</li>\n</ul>\n<h2 id=\"how-it-works\">How it works</h2>\n<p>When integrating netID’s Single Sign-On (SSO) and consent management solutions, netID partners must implement a request to the netID browser-based JavaScript API. The properties returned from the API must be persisted in the browser session as first-party cookies, in <code>localStorage</code>, or in <code>sessionStorage</code>.</p>\n<p>NetID properties like <code>tpid</code> can be used with client-side tags in Tealium iQ to integrate with advertising technologies on your webpage.</p>\n<p>Additionally, the same netID properties are collected by the Tealium Collect tag and made available as attributes in EventStream and AudienceStream. With netID saved as a visitor attribute, the visitor profiles can then be activated through real-time connectors to advertising vendors.</p>\n<p>For more information about the netID browser-based JavaScript API, see the following:</p>\n<ul>\n<li><a href=\"https://developerzone.netid.dev/1.6/cmp/browser-based/#response\">netID: The data points returned from the API</a></li>\n<li><a href=\"https://developerzone.netid.dev/1.6/cmp/browser-based/#response-properties\">netID: Response properties descriptions</a></li>\n</ul>\n<h2 id=\"tealium-iq\">Tealium iQ</h2>\n<p>netID properties that have been stored in the browser can be fetched as part of the data layer (UDO object). This data can then be used in Tealium iQ load rules and tag data mappings where relevant.</p>\n<p>For example, if you’ve persisted the netID <code>tpid</code> parameter in a first-party cookie, add a new variable of type <strong>First-Party Cookie</strong> in the data layer, and set the value for <strong>Source</strong> to the cookie’s name (for example, <code>netid_tpid</code>).</p>\n<figure><a class=\"slb\" href=\"/images/industries/netid-add-variable.png\"><img src=\"https://docs.tealium.com/images/industries/netid-add-variable.png\"\n         alt=\"netID add variable\"\n         title=\"netID add variable\"/>\n    </a>\n</figure>\n<p>As a netID partner, use one of the following methods to include netID’s properties as key-value pairs in the Tealium Data Layer:</p>\n<ul>\n<li>\n<p><strong>First-Party-Cookie</strong>: Persist the netID <code>tpid</code> as a <a href=\"/platforms/javascript/data-layer/#cookies\">first-party-cookie</a> named <code>netid_tpid</code> in the browser, and it will appear in the data layer with the <code>cp.</code> prefix alongside Tealium standard cookies:</p>\n<pre tabindex=\"0\"><code>{\n  ...,\n  &#34;cp.netid_tpid&#34;: &#34;Bst040QDNr1nB9JM6sWH0I9__70JEvRyIiKvvd7G0MQLQ&#34;,\n  ...\n}\n</code></pre></li>\n<li>\n<p><strong>Universal Data Object (UDO)</strong>: Use a <a href=\"/iq-tag-management/data-layer/data-layer-variables/#udo-variable\">UDO variable</a> to explicitly persist the netID property in <code>utag_data</code>. For example, add the netID identity property as <code>netid_tpid</code> to the UDO of your pages:</p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-js\" data-lang=\"js\"><span style=\"display:flex;\"><span><span style=\"color:#f92672\">&lt;</span><span style=\"color:#a6e22e\">script</span> <span style=\"color:#a6e22e\">type</span><span style=\"color:#f92672\">=</span><span style=\"color:#e6db74\">&#34;text/javascript&#34;</span><span style=\"color:#f92672\">&gt;</span>\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">var</span> <span style=\"color:#a6e22e\">utag_data</span><span style=\"color:#f92672\">=</span>{\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#34;tealium_event&#34;</span> <span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;page_view&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#34;page_name&#34;</span>     <span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;product_page&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#34;product_id&#34;</span>    <span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;423543&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#34;netid_tpid&#34;</span>    <span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;12345&#34;</span>\n</span></span><span style=\"display:flex;\"><span>    };\n</span></span><span style=\"display:flex;\"><span><span style=\"color:#f92672\">&lt;</span><span style=\"color:#960050;background-color:#1e0010\">/script&gt;</span>\n</span></span></code></pre></div></li>\n<li>\n<p><strong>Track an event</strong>: Use <a href=\"/platforms/javascript/track/#track-events\"><code>utag.link()</code></a> to track a successful netID authentication and response from the browser-based JavaScript API, and include the netID <code>tpid</code> as <code>netid_tpid</code> in the payload:</p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-json\" data-lang=\"json\"><span style=\"display:flex;\"><span><span style=\"color:#960050;background-color:#1e0010\">utag.link(</span>{\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;tealium_event&#34;</span>     : <span style=\"color:#e6db74\">&#34;netid_login&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;netid_tpid&#34;</span>        : <span style=\"color:#e6db74\">&#34;12345&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#960050;background-color:#1e0010\">...</span>\n</span></span><span style=\"display:flex;\"><span>}<span style=\"color:#960050;background-color:#1e0010\">);</span>\n</span></span></code></pre></div></li>\n</ul>\n<h2 id=\"eventstream-api\">EventStream API</h2>\n<p>After the Tealium Collect Tag captures netID properties from the browser’s data layer, this data is processed as event attributes.</p>\n<p>To do this, create an event attribute to capture the <code>netid_tpid</code> value. In the following example, the attribute is set to the value of the first-party cookie:</p>\n<figure><a class=\"slb\" href=\"/images//industries/netid-es-add-attribute.png\"><img src=\"https://docs.tealium.com/images//industries/netid-es-add-attribute.png\"\n         alt=\"netID add attribute\"\n         title=\"netID add attribute\"/>\n    </a>\n</figure>\n<p>netID&rsquo;s identifier (<code>tpid</code>) can be activated as a first-party (Advertiser) ID to an advertising platform using their connector, such as:</p>\n<ul>\n<li><a href=\"/server-side-connectors/adform-segments-connector/\">Adform</a></li>\n<li><a href=\"/server-side-connectors/the-trade-desk-first-party-data-connector/\">The Trade Desk</a></li>\n</ul>\n<h3 id=\"example\">Example</h3>\n<p>If you use Adform, map the <code>netid_tpid</code> event attribute to Adform’s First-Party ID attribute:</p>\n<figure><a class=\"slb\" href=\"/images//industries/netid-es-attribute-mapping.png\"><img src=\"https://docs.tealium.com/images//industries/netid-es-attribute-mapping.png\"\n         alt=\"netID attribute mapping\"\n         title=\"netID attribute mapping\"/>\n    </a>\n</figure>\n<h2 id=\"audiencestream-cdp\">AudienceStream CDP</h2>\n<p>This data is processed as event attributes and can be stored as visitor attributes on the real-time visitor profile.</p>\n<p>To do this, set a visitor string attribute on the visitor profile to the <code>netid_tpid</code> event attribute value. In the following example, the attribute is set to the value of the first-party cookie:</p>\n<figure><a class=\"slb\" href=\"/images//industries/netid-as-add-attribute.png\"><img src=\"https://docs.tealium.com/images//industries/netid-as-add-attribute.png\"\n         alt=\"netID add attribute\"\n         title=\"netID add attribute\"/>\n    </a>\n</figure>\n<p>The visitor ID can then be used to create audiences for visitors using netID as their authentication method.</p>\n<figure><a class=\"slb\" href=\"/images//industries/netid-as-new-audience.png\"><img src=\"https://docs.tealium.com/images//industries/netid-as-new-audience.png\"\n         alt=\"netID new audience\"\n         title=\"netID new audience\"/>\n    </a>\n</figure>\n<p>For real-time activation to advertising platforms such as Adform and The Trade Desk, use their Tealium connectors:</p>\n<ul>\n<li><a href=\"/server-side-connectors/adform-segments-connector/\">Adform</a></li>\n<li><a href=\"/server-side-connectors/the-trade-desk-first-party-data-connector/\">The Trade Desk</a></li>\n</ul>\n<h2 id=\"references\">References</h2>\n<ul>\n<li><a href=\"https://developerzone.netid.dev/1.6/cmp/browser-based/\">netID: Browser-Based JavaScript API</a></li>\n<li><a href=\"/server-side-connectors/adform-segments-connector/\">Adform: Segments Connector</a></li>\n<li><a href=\"https://www.adformhelp.com/hc/en-us/articles/9740579323153-Use-First-Party-IDs-for-Site-Tracking\">Adform: Using First Party IDs</a></li>\n<li><a href=\"/server-side-connectors/the-trade-desk-first-party-data-connector/\">The Trade Desk First Party Data Connector</a></li>\n<li><a href=\"/iq-tag-management/data-layer/about/\">Tealium Data Layer</a></li>\n</ul>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/client-side-tags/neustar-fabrick-id-tag/",
            "title": "Neustar Fabrick ID Tag Setup Guide",
            "body": "<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>When using this tag with <code>utag</code> version 4.50 or later, you must set the <code>utag.js</code> <a href=\"/platforms/javascript/settings/#always_set_v_id\"><code>always_set_v_id</code> setting</a> to <code>true</code>. This setting ensures that the visitor ID is available for cookie synchronization. For more information, see the <a href=\"/platforms/javascript/version-4-50/#updating-to-version-450-or-later\">utag 4.50 release notes</a> and <a href=\"https://support.tealiumiq.com/en/support/solutions/articles/36000535887-considerations-for-tealium-visitor-id-when-upgrading-to-utag-4-50-\">Considerations for tealium_visitor_id when upgrading to utag 4.50+</a>.</p>\n<h2 id=\"tag-tips\">Tag tips</h2>\n<ul>\n<li>If left blank, the Tealium Account and Profile are automatically populated</li>\n<li>The following attributes are sent to Tealium server-side through <code>neustar_fabrickId_sync</code>:\n<ul>\n<li><code>fabrickId</code></li>\n<li><code>visitor_id</code></li>\n<li><code>element_one</code> (Optional)</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"tag-configuration\">Tag configuration</h2>\n<p>Go to the tag marketplace to add a new tag. For more information about how to add a tag, see <a href=\"/iq-tag-management/tags/manage/\">Manage tags</a>.</p>\n<p>When adding the tag, configure the following settings:</p>\n<ul>\n<li><strong>API Key</strong>: (Required) Neustar-provided API key.</li>\n<li><strong>FabrickId Timespan Days</strong>: How often the <code>fabrickId</code> will change. Default is seven days.</li>\n<li><strong>Tealium Account</strong>: Your Tealium Account.</li>\n<li><strong>Tealium Profile</strong>: Your Tealium Profile.</li>\n<li><strong>Data Source Key</strong>: (Required) The data source key from Tealium server-side.</li>\n</ul>\n<h2 id=\"load-rules\">Load rules</h2>\n<p>Load the tag on all pages or set conditions for when your tag will load. For more information, see <a href=\"/iq-tag-management/load-rules/about/\">About load rules</a>.</p>\n<h2 id=\"data-mappings\">Data mappings</h2>\n<p>Mapping is the process of sending data from a data layer variable to the corresponding destination variable of the vendor tag. For more information, see <a href=\"/iq-tag-management/data-mappings/about/\">About data mappings</a>.</p>\n<p>The available categories are:</p>\n<h3 id=\"standard\">Standard</h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Variable</th>\n<th style=\"text-align:left\">Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\">Base Url (<code>base_url</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Event Url (<code>event_url</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Api Key (<code>apiKey</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">FabrickId Timespan Days (<code>daysSyncPeriod</code>)</td>\n<td style=\"text-align:left\">Number</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Tealium Account (<code>tealium_account</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Tealium Profile (<code>tealium_profile</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Data Source Key (<code>tealium_datasource</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Hashed email address (<code>e</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">E.164 standard hashed phone number (<code>p</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">IPv4 Address (<code>raw</code> i4)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">IPv6 Address (<code>raw</code> i6)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Mobile Advertising ID (<code>m</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Identifier for Advertising (<code>ia</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Denotes the source for the IFA (<code>ifa_type</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Indicates whether the user can be tracked or not (<code>lmt</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n<tr>\n<td style=\"text-align:left\">Partner or advertiser&rsquo;s first-party user ID (<code>1pd</code>)</td>\n<td style=\"text-align:left\">String</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/client-side-tags/the-trade-desk-cookie-matching-service-tag/",
            "title": "The Trade Desk Cookie Matching Service Tag Setup Guide",
            "body": "<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>When using this tag with <code>utag</code> version 4.50 or later, you must set the <code>utag.js</code> <a href=\"/platforms/javascript/settings/#always_set_v_id\"><code>always_set_v_id</code> setting</a> to <code>true</code>. This setting ensures that the visitor ID is available for cookie synchronization. For more information, see the <a href=\"/platforms/javascript/version-4-50/#updating-to-version-450-or-later\">utag 4.50 release notes</a> and <a href=\"https://support.tealiumiq.com/en/support/solutions/articles/36000535887-considerations-for-tealium-visitor-id-when-upgrading-to-utag-4-50-\">Considerations for tealium_visitor_id when upgrading to utag 4.50+</a>.</p>\n<h2 id=\"requirements\">Requirements</h2>\n<ul>\n<li>iQ Tag Management</li>\n<li>AudienceStream</li>\n</ul>\n<h2 id=\"how-it-works\">How it works</h2>\n<p>The Trade Desk Cookie Matching Service tag sets a new variable named <code>ttd_uuid</code>. It is stored as a session cookie and as a standard data layer variable. The tag triggers only once per session, by default.</p>\n<p>The Trade Desk Cookie Matching Service tag communicates with the Trade Desk servers to request the current user&rsquo;s identifier. When this value is returned to the tag, the value is passed to AudienceStream so that it can be used to populate a visitor attribute containing the synced user ID. This attribute can then be used in The Trade Desk connector actions as a mapping to &ldquo;Trade Desk ID (TDID)&rdquo;.</p>\n<h2 id=\"data-layer-variables\">Data Layer Variables</h2>\n<p>Before you add the tag, create the following data layer variables:</p>\n<ul>\n<li><code>ttd_uuid</code>: UDO Variable</li>\n<li><code>utag_main_ttd_uuid</code>: First Party Cookie</li>\n</ul>\n<p>These variables are populated automatically by the cookie matching tag.</p>\n<figure><a class=\"slb\" href=\"/images/client-side-tags/the-trade-desk-cookie.png\"><img src=\"https://docs.tealium.com/images/client-side-tags/the-trade-desk-cookie.png\"\n         alt=\"The Trade Desk Cookie\"\n         title=\"The Trade Desk Cookie\"/>\n    </a>\n</figure>\n<h2 id=\"tag-configuration\">Tag Configuration</h2>\n<p>Go to the tag marketplace to add a new tag. For more information about how to add a tag, see <a href=\"/iq-tag-management/tags/manage/\">Manage tags</a>.</p>\n<p>After adding the tag, configure the following settings:</p>\n<ul>\n<li><strong>Tealium Account</strong>: leave blank unless sending The Trade Desk user ID to a different account.</li>\n<li><strong>Tealium Profile</strong>: leave blank unless sending The Trade Desk user ID to a different profile.</li>\n</ul>\n<h3 id=\"load-rules\">Load Rules</h3>\n<p><a href=\"/iq-tag-management/load-rules/about/\">Load rules</a> determine when and where to load an instance of this tag on your site.</p>\n<p>This tag only needs to run if the cookie match has not already occurred. You can determine this by using the cookie variable <code>utag_main_ttd_uuid</code> in a load rule condition such as:</p>\n<p><code>utag_main_ttd_uuid</code> is not defined</p>\n<p>The tag also has built-in logic to only fire when the cookie is not defined, but using a load rule ensures that the tag is not loaded on a page when it has already run for the current session.</p>\n<h2 id=\"data-mappings\">Data Mappings</h2>\n<p>Mapping is the process of sending data from a <a href=\"/iq-tag-management/data-mappings/about/\">data layer variable</a> to the corresponding destination variable of the vendor tag. For instructions on how to map a variable to a tag destination, see <a href=\"/iq-tag-management/data-mappings/manage/\">data mappings</a>.</p>\n<table>\n<thead>\n<tr>\n<th><strong>Destination Name</strong></th>\n<th><strong>Type</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>tealium_account</code></td>\n<td>String</td>\n<td>The Tealium account to sync the user ID to. The default is the current account.</td>\n</tr>\n<tr>\n<td><code>tealium_profile</code></td>\n<td>String</td>\n<td>The Tealium profile to sync the user ID to. The default is the current profile.</td>\n</tr>\n<tr>\n<td><code>gdpr</code></td>\n<td>Boolean</td>\n<td>Pass a value that indicates if the current user resides in the European Union (EU), and therefore subject to GDPR.<ul><li>Set to <code>0</code> (default) if the user is not subject to GDPR.<br> Set to <code>1</code> if the user is subject to GDPR.</li><li>If you set this value to <code>0</code> and the visitors are located in the EU, the Cookie Sync Service returns an empty array.</li></ul></td>\n</tr>\n<tr>\n<td><code>gdpr_consent_string</code></td>\n<td>String</td>\n<td>Base64 URL-encoded GDPR consent string.</td>\n</tr>\n<tr>\n<td><code>domain</code></td>\n<td>String</td>\n<td>The domain where the cookie synchronization initiates. <br> NOTE: You must add this domain to <strong>Allowlist</strong> in The Trade Desk configuration.</td>\n</tr>\n<tr>\n<td><code>order_id</code></td>\n<td>String</td>\n<td>Overrides the <code>_corder</code> e-commerce extension value.</td>\n</tr>\n</tbody>\n</table>\n<h2 id=\"audiencestream-setup\">AudienceStream Setup</h2>\n<p>After you save and publish your changes to Prod, the new variables will be available in AudienceStream. The <code>ttd_uuid</code> variable appears as an event attribute, but you must create it as a visitor attribute so that it can be used in The Trade Desk connector action.</p>\n<p>To add a visitor attribute to store the <code>ttd_uuid</code> value:</p>\n<ol>\n<li>Navigate to <strong>AudienceStream &gt; Attributes</strong>.</li>\n<li>Click <strong>Add Attribute</strong> and select <strong>Visitor</strong> scope, then <strong>String</strong> data type.</li>\n<li>Enter the name <code>Trade Desk User ID</code>.</li>\n<li>Click <strong>Add Enrichment</strong> and select <strong>Set String</strong>.</li>\n<li>From <strong>Set String to</strong> drop-down menu select <code>ttd_uuid</code>.</li>\n<li>Click <strong>Finish</strong>.</li>\n</ol>\n<p>You can now create audiences of visitors that have their Trade Desk User ID populated. Those audiences will be used in connector actions with The Trade Desk. Map this attribute to the &ldquo;Trade Desk ID (TDID)&rdquo; parameter in The Trade Desk connector actions.</p>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/server-side-connectors/the-trade-desk-first-party-data-connector/",
            "title": "The Trade Desk First Party Data connector setup guide",
            "body": "<h2 id=\"configuration\">Configuration</h2>\n<p>Go to the Connector Marketplace and add a new connector. For general instructions on how to add a connector, see <a href=\"/server-side/connectors/about/\">About Connectors</a>.</p>\n<p>After adding the connector, configure the following settings:</p>\n<ul>\n<li><strong>Agency Secret Key</strong>: The secret key provided to you by The Trade Desk.</li>\n</ul>\n<h2 id=\"actions\">Actions</h2>\n<table>\n<thead>\n<tr>\n<th>Action Name</th>\n<th style=\"text-align:center\">AudienceStream</th>\n<th style=\"text-align:center\">EventStream</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Send First Party Advertiser Data</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✓</td>\n</tr>\n</tbody>\n</table>\n<p>Enter a name for the action and select the action type from the drop-down menu.</p>\n<p>The following section describes how to set up parameters and options for each action.</p>\n<h3 id=\"send-first-party-advertiser-data\">Send First Party Advertiser Data</h3>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>Use either the <code>TDID</code> parameter or the <code>UID2</code> parameter, not both. Setting a value for both <code>TDID</code> and <code>UID2</code> can cause connector errors.</p>\n<h4 id=\"parameters\">Parameters</h4>\n<table>\n<thead>\n<tr>\n<th><strong>Parameter</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Data Center Region</td>\n<td>(Required) Select the data center geographically closest to where user data comes from.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"advertiser-columns\">Advertiser Columns</h4>\n<table>\n<thead>\n<tr>\n<th><strong>Parameter</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Advertiser ID</td>\n<td>(Required) Advertiser ID. Available types are <code>DAID</code>, <code>TDID</code>, <code>UID2</code>, <code>EUID</code>, <code>IDL</code> (<code>RampID</code>), <code>ID5</code>, and <code>netID</code>. Only one ID is required.</td>\n</tr>\n<tr>\n<td>Device Advertising ID (DAID)</td>\n<td>Device Advertising ID (<code>DAID</code>)</td>\n</tr>\n<tr>\n<td>Trade Desk ID (TDID)</td>\n<td>Trade Desk ID (<code>TDID</code>)</td>\n</tr>\n<tr>\n<td>Unified ID (UID2 already hashed)</td>\n<td>Unified ID (<code>UID2</code>). If already hashed, use the <strong>Already SHA256 Hashed</strong> option and provide a value that has been whitespace trimmed, lowercased, and hashed using SHA256. For more information, see <a href=\"/server-side/functions/event-visitor-functions/uid2/\">Use a function to generate a UID2</a>.</td>\n</tr>\n<tr>\n<td>UID2 Token (encrypted advertising token)</td>\n<td>The encrypted UID2 advertising token. This token is case-sensitive.</td>\n</tr>\n<tr>\n<td>Identity Link (IDL)</td>\n<td>Identity Link (<code>IDL</code>)</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"data-columns\">Data Columns</h4>\n<table>\n<thead>\n<tr>\n<th><strong>Parameter</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Override TTL in Minutes</td>\n<td>Override time to live (<code>ttl</code>), in minutes. The maximum <code>ttl</code> is 259200 minutes (180 days).</td>\n</tr>\n<tr>\n<td>Override Timestamp</td>\n<td>Override timestamp</td>\n</tr>\n<tr>\n<td>Data Name</td>\n<td>(Required) Data Name</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/server-side-connectors/the-trade-desk-third-party-data-connector/",
            "title": "The Trade Desk Third-Party Data Connector Setup Guide",
            "body": "<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>This connector is not currently available in the Connector Marketplace. Using The Trade Desk Third-Party Data connector requires support from both Tealium and The Trade Desk account managers. To use this connector, contact your Tealium account manager.</p>\n<h2 id=\"api-information\">API information</h2>\n<p>This connector uses the following vendor API:</p>\n<ul>\n<li>API Name: The Trade Desk API</li>\n<li>API Version: v3.0</li>\n<li>API Endpoint: <code>https://bulk-data.adsrvr.org</code>\n<ul>\n<li>Data Rate Endpoint: <code>POST /datarate/batch</code></li>\n<li>Third-Party Endpoint: <code>POST /data/thirdparty</code></li>\n</ul>\n</li>\n<li>Documentation: <a href=\"https://partner.thetradedesk.com/v3/portal/data/doc/post-data-thirdparty\">The Trade Desk API</a></li>\n</ul>\n<h2 id=\"batch-limits\">Batch limits</h2>\n<p>This connector uses batched requests to support high-volume data transfers to the vendor. Parallel processing may result in events reaching the vendor out of sequence. Add a sequence value to events if ordering is important. For more information, see <a href=\"/server-side/connectors/batched-actions/\">Batched actions</a>. Requests are queued until one of the following thresholds is met or the profile is published:</p>\n<ul>\n<li>Max number of requests: 10000</li>\n<li>Max time since oldest request: 30 minutes</li>\n<li>Max size of requests: 2 MB</li>\n</ul>\n<h2 id=\"configuration\">Configuration</h2>\n<p>Go to the Connector Marketplace and add a new connector. For general instructions on how to add a connector, see <a href=\"/server-side/connectors/about/\">About Connectors</a>.</p>\n<p>After adding the connector, configure the following settings:</p>\n<ul>\n<li><strong>Secret Key</strong>: (Required) The secret key.</li>\n<li><strong>API Base URL</strong>: (Required) Select your API base URL.</li>\n</ul>\n<h2 id=\"admin-configuration\">Admin configuration</h2>\n<h3 id=\"generate-authentication-token\">Generate authentication token</h3>\n<p>You must generate an authentication token with a valid username and password before the admin tasks can be performed. Authentication only applies to the admin tasks and is not required for the connector to work.</p>\n<ul>\n<li><strong>Login</strong>: (Required) Enter your login.</li>\n<li><strong>Password</strong>: (Required) Enter your password.</li>\n</ul>\n<h3 id=\"create-taxonomy-segment\">Create taxonomy segment</h3>\n<p>For more information, see <a href=\"https://partner.thetradedesk.com/v3/portal/data/doc/DataTaxonomyDesign#top\">The Trade Desk Partner Portal: Third-Party Data Taxonomy Design</a>.</p>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Provider ID</td>\n<td>(Required) The unique ID for your provider account, which your Account Manager provided to you.</td>\n</tr>\n<tr>\n<td>Provider Element ID</td>\n<td>(Required) The unique ID assigned to the segment when the taxonomy was designed. The ID must be 512 characters long or less. This value cannot be changed after you create it.</td>\n</tr>\n<tr>\n<td>Parent Element ID</td>\n<td>(Required) The provider element ID value from the parent segment in the taxonomy. This parameter establishes the hierarchical structure of your taxonomy. This value cannot be changed after you create it. All data providers use the <code>ROOT</code> base element of the taxonomy.</td>\n</tr>\n<tr>\n<td>Display Name</td>\n<td>(Required) The name for the segment that buyers see in the DMP user interface. The display name must be 256 characters long or less, but we recommend 50 characters or less for readability, especially for lower-level child elements with longer full paths. Do not include tabs or special characters such as <code>'</code>, <code>&quot;</code>, or <code>^</code>.</td>\n</tr>\n<tr>\n<td>Buyable</td>\n<td>(Required) Set to <code>true</code> to make the segment visible and available for buyers in the DMP. For container elements, set this property value to <code>false</code>, since they are used only for organizing child elements and assigning rates. If you change the property value to <code>false</code> for a buyable segment, any customers that currently have the segment in their audience can use it until their campaign ends.</td>\n</tr>\n<tr>\n<td>Description</td>\n<td>(Optional) A description of the data segment, displayed to customers in the DMP. The description must be 4,000 characters long or less, but we recommend 256 characters or less for readability.</td>\n</tr>\n<tr>\n<td>Is Direct IP Targeting</td>\n<td>(Optional) If <code>true</code>, the <code>TargetingData</code> used or created is type <code>16</code> (<code>DirectIpTargeting</code>) instead of the default <code>7</code> (<code>ThirdPartyData</code>).</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"assign-rate-to-segment\">Assign rate to segment</h3>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Provider ID</td>\n<td>(Required) The unique ID for your provider account, which your Account Manager provided to you.</td>\n</tr>\n<tr>\n<td>Provider Element ID</td>\n<td>(Required) A unique ID that identifies this data element in the system.</td>\n</tr>\n<tr>\n<td>Brand ID</td>\n<td>(Required) The unique ID that identifies a provider-managed brand.</td>\n</tr>\n<tr>\n<td>Rate Level</td>\n<td>(Required) The rate level for the third-party data. To request access, contact your Technical Account Manager.<br><code>Partner</code>: For specific partners and their advertisers.<br><code>Advertiser</code>: For specific advertisers. Note that this rate level requires additional permissions.</td>\n</tr>\n<tr>\n<td>Partner ID</td>\n<td>(Required) The platform ID of the partner eligible to access data segments at this rate in a custom taxonomy.</td>\n</tr>\n<tr>\n<td>Advertiser ID</td>\n<td>(Required) The platform ID of the advertiser eligible to access data segments at this rate in a custom taxonomy.</td>\n</tr>\n<tr>\n<td>Rate Type</td>\n<td>(Required) The data rate type for the segment. All system-level data rates for syndicated taxonomies must be assigned as hybrid rates, which use a percentage of media cost with a maximum CPM (cost per thousand) cap. This means that you must set this property to <code>Hybrid</code> and provide values for both <code>CPMRate</code> and <code>PercentOfMediaCostRate</code> properties. While custom taxonomies can use any data rate type, hybrid rates are strongly recommended.</td>\n</tr>\n<tr>\n<td>CPM Rate Amount</td>\n<td>(Required) The CPM rate amount.</td>\n</tr>\n<tr>\n<td>CPM Rate Currency Code</td>\n<td>(Required) The CPM rate currency code.</td>\n</tr>\n<tr>\n<td>Percent of Media Cost Rate</td>\n<td>(Optional) A percentage of media cost to be used in conjunction with the <code>CPMRate</code> cap for the hybrid data rate (selected in <strong>Rate Type</strong>). Enter the percentage as a decimal.</td>\n</tr>\n</tbody>\n</table>\n<h2 id=\"actions\">Actions</h2>\n<table>\n<thead>\n<tr>\n<th>Action Name</th>\n<th style=\"text-align:center\">AudienceStream</th>\n<th style=\"text-align:center\">EventStream</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Upload 3rd Party Data</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✗</td>\n</tr>\n<tr>\n<td>Delete Third Party Data</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✗</td>\n</tr>\n</tbody>\n</table>\n<p>Enter a name for the action and select the action type from the drop-down menu.</p>\n<p>The following section describes how to set up parameters and options for each action.</p>\n<h3 id=\"upload-3rd-party-data\">Upload 3rd Party Data</h3>\n<h4 id=\"parameters\">Parameters</h4>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Data Provider ID</td>\n<td>(Required) The provider ID supplied by your Technical Account Manager.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"ids\">IDs</h4>\n<p>At least one ID parameter is required. Multiple IDs may be included in the same request. The Trade Desk supports the following IDs:</p>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>TDID</td>\n<td>The Trade Desk 36-character GUID (including dashes) for this user.</td>\n</tr>\n<tr>\n<td>DAID</td>\n<td>The raw device ID for this user sent in 36-character GUID format (including dashes). Use iOS IDFA or Android&rsquo;s AAID.</td>\n</tr>\n<tr>\n<td>UID2Token (already SHA256 hashed)</td>\n<td>The user&rsquo;s Unified ID 2.0, already SHA256 hashed.</td>\n</tr>\n<tr>\n<td>UID2Token (apply SHA256 hash)</td>\n<td>The user&rsquo;s Unified ID 2.0, to which a SHA256 hash is applied.</td>\n</tr>\n<tr>\n<td>UID2</td>\n<td>The user&rsquo;s Unified ID 2.0 as a 44-character base64-encoded SHA-256 string. For more information, see <a href=\"https://partner.thetradedesk.com/v3/portal/data/doc/DataPiiNormalization\">The Trade Desk Partner Portal: PII Normalization and Hash Encoding</a> and <a href=\"https://partner.thetradedesk.com/v3/portal/data/doc/UnifiedIDs\">Unified IDs</a>.</td>\n</tr>\n<tr>\n<td>EUIDToken (already SHA256 hashed)</td>\n<td>The user&rsquo;s European Unified ID, already SHA256 hashed.</td>\n</tr>\n<tr>\n<td>EUIDToken (apply SHA256 hash)</td>\n<td>The user&rsquo;s European Unified ID, to which a SHA256 hash is applied</td>\n</tr>\n<tr>\n<td>EUID</td>\n<td>The user&rsquo;s European Unified ID as a 44-character base64-encoded SHA-256 string. For more information, see <a href=\"https://partner.thetradedesk.com/v3/portal/data/doc/DataPiiNormalization\">The Trade Desk Partner Portal: PII Normalization and Hash Encoding</a>. EUID offers user transparency and privacy controls designed to meet market requirements in Europe and the UK, and it requires the same normalization and encoding of email addresses as UID2. For more information, see <a href=\"https://partner.thetradedesk.com/v3/portal/data/doc/UnifiedIDs\">The Trade Desk Partner Portal: Unified IDs</a>.</td>\n</tr>\n<tr>\n<td>IDL</td>\n<td>The 49-character or 70-character RampID (previously known as IdentityLink). This value must be a RampID from LiveRamp that is mapped specifically for The Trade Desk. For more information about mapping a RampID, see <a href=\"https://sidecar.readme.io/docs/getting-started\">LiveRamp: LiveRamp&rsquo;s Sidecar</a>.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"data\">Data</h4>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Name</td>\n<td>(Required) The segment name. Maximum 128 characters.</td>\n</tr>\n<tr>\n<td>TTL in Minutes</td>\n<td>(Required) Time to live (TTL) is the amount of time (in minutes) during which this user is to remain active relative to the <code>TimeStampUtc</code> value. When the TTL has expired, the user is no longer used for targeting. The maximum TTL is 259200 minutes (180 days).</td>\n</tr>\n<tr>\n<td>Timestamp</td>\n<td>The timestamp of when a user is eligible for a segment. If not specified, the timestamp is assigned based on the time when the data is processed. This timestamp is used to determine a user&rsquo;s recency for targeting and bid adjustments.</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"delete-third-party-data\">Delete Third Party Data</h3>\n<h4 id=\"parameters-1\">Parameters</h4>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Data Provider ID</td>\n<td>Required. The provider ID supplied to you by your Technical Account Manager.</td>\n</tr>\n<tr>\n<td>Request Type</td>\n<td><ul><li><strong>Opt-out</strong>: The Trade Desk will opt out the ID from your data segments by setting its TTL value to <code>0</code>, thereby limiting its targeting in your campaigns.</li><li><strong>Delete</strong>: The Trade Desk deletes the ID from your datasets, including data segments and <code>REDS</code> feeds.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"ids-1\">IDs</h4>\n<p>At least one ID parameter is required. Multiple IDs may be included in the same request. The Trade Desk supports the following IDs:</p>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>TDID</td>\n<td>The Trade Desk 36-character GUID (including dashes) for this user.</td>\n</tr>\n<tr>\n<td>DAID</td>\n<td>The raw device ID for this user sent in 36-character GUID format (including dashes). Use iOS IDFA or Android AAID.</td>\n</tr>\n<tr>\n<td>UID2Token (already SHA256 hashed)</td>\n<td>The user&rsquo;s Unified ID 2.0, already SHA256 hashed.</td>\n</tr>\n<tr>\n<td>UID2Token (apply SHA256 hash)</td>\n<td>The user&rsquo;s Unified ID 2.0, to which a SHA256 hash is applied.</td>\n</tr>\n<tr>\n<td>UID2</td>\n<td>The user&rsquo;s Unified ID 2.0 as a 44-character base64-encoded SHA-256 string. For more information, see <a href=\"https://partner.thetradedesk.com/v3/portal/data/doc/DataPiiNormalization\">The Trade Desk Partner Portal: PII Normalization and Hash Encoding</a> and <a href=\"https://partner.thetradedesk.com/v3/portal/data/doc/UnifiedIDs\">Unified IDs</a>.</td>\n</tr>\n<tr>\n<td>EUIDToken (already SHA256 hashed)</td>\n<td>The user&rsquo;s European Unified ID, already SHA256 hashed.</td>\n</tr>\n<tr>\n<td>EUIDToken (apply SHA256 hash)</td>\n<td>The user&rsquo;s European Unified ID, to which a SHA256 hash is applied</td>\n</tr>\n<tr>\n<td>EUID</td>\n<td>The user&rsquo;s European Unified ID as a 44-character base64-encoded SHA-256 string. For more information, see <a href=\"https://partner.thetradedesk.com/v3/portal/data/doc/DataPiiNormalization\">The Trade Desk Partner Portal: PII Normalization and Hash Encoding</a>. EUID offers user transparency and privacy controls designed to meet market requirements in Europe and the UK, and it requires the same normalization and encoding of email addresses as UID2. For more information, see <a href=\"https://partner.thetradedesk.com/v3/portal/data/doc/UnifiedIDs\">The Trade Desk Partner Portal: Unified IDs</a>.</td>\n</tr>\n<tr>\n<td>RampID</td>\n<td>The 49-character or 70-character RampID (previously known as IdentityLink). This must be a RampID from LiveRamp that is mapped specifically for The Trade Desk. For more information, see <a href=\"https://sidecar.readme.io/docs/getting-started\">LiveRamp: LiveRamp&rsquo;s Sidecar</a>.</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/client-side-tags/the-trade-desk-universal-pixel-tag/",
            "title": "The Trade Desk Universal Pixel Tag Setup Guide",
            "body": "<h2 id=\"tag-configuration\">Tag Configuration</h2>\n<p>First, go to the tag marketplace and add The Trade Desk Universal Pixel Tag to your profile (See <a href=\"/iq-tag-management/tags/manage/#add-a-tag\">Add a tag</a>).</p>\n<p>After adding the tag, configure the following settings:</p>\n<ol>\n<li><strong>Advertiser ID</strong>: Enter your Advertiser ID supplied by Trade Desk. This is present in your Universal Pixel Tag.</li>\n<li><strong>Pixel ID</strong>: Enter your Pixel ID supplied by Trade Desk. This is present in your Universal Pixel Tag.</li>\n</ol>\n<p class=\"tip\"><i class=\"fa fa-info-circle\"></i>Use data mappings if you prefer to configure the tag settings dynamically.</p>\n<h2 id=\"load-rules\">Load Rules</h2>\n<p>Load the tag on all pages or set conditions for when your tag will load. For more information, see <a href=\"/iq-tag-management/load-rules/about/\">About load rules</a>.</p>\n<p>Recommended Load Rule: <strong>Load on all pages</strong>.</p>\n<h2 id=\"data-mappings\">Data Mappings</h2>\n<p>Mapping is the process of sending data from a data layer variable to the corresponding destination variable of the vendor tag. For more information, see <a href=\"/iq-tag-management/data-mappings/about/\">About data mappings</a>.</p>\n<p>The destination variables for the The Trade Desk Universal Pixel Tag are built into its Data Mapping tab.</p>\n<p>The available categories are:</p>\n<h3 id=\"standard\">Standard</h3>\n<table>\n<thead>\n<tr>\n<th><strong>Destination Name</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Advertiser ID</td>\n<td>Unique advertiser identifier supplied by Trade Desk</td>\n</tr>\n<tr>\n<td>Pixel ID</td>\n<td>Unique pixel identifier supplied by Trade Desk</td>\n</tr>\n<tr>\n<td><code>td1</code></td>\n<td>Customer parameter #1</td>\n</tr>\n<tr>\n<td><code>td2</code></td>\n<td>Customer parameter #2</td>\n</tr>\n<tr>\n<td><code>td3</code></td>\n<td>Customer parameter #3</td>\n</tr>\n<tr>\n<td><code>td4</code></td>\n<td>Customer parameter #4</td>\n</tr>\n<tr>\n<td><code>td5</code></td>\n<td>Customer parameter #5</td>\n</tr>\n<tr>\n<td><code>td6</code></td>\n<td>Customer parameter #6</td>\n</tr>\n<tr>\n<td><code>td7</code></td>\n<td>Customer parameter #7</td>\n</tr>\n<tr>\n<td><code>td8</code></td>\n<td>Customer parameter #8</td>\n</tr>\n<tr>\n<td><code>td9</code></td>\n<td>Customer parameter #9</td>\n</tr>\n<tr>\n<td><code>td10</code></td>\n<td>Customer parameter #10</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"consent-gdpr\">Consent (GDPR)</h3>\n<p>The consent parameters follow the IAB specification for URL-based services.</p>\n<p>Reference: <a href=\"https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/URL-based%20Consent%20Passing_%20Framework%20Guidance.md\">IAB GDPR Consent Passing for URL-Based Services</a></p>\n<p class=\"tip\"><i class=\"fa fa-info-circle\"></i>The creator of the URL should ensure these parameters are added only once and are passed to services that are expecting them and can properly handle them.</p>\n<table>\n<thead>\n<tr>\n<th>Destination Name</th>\n<th><strong>Value</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>gdpr</code></td>\n<td><code>0</code> / <code>1</code></td>\n<td>Determines if GDPR should apply to the user. Value of <code>1</code> means <code>yes</code>, default value of <code>0</code> means <code>no</code>.</td>\n</tr>\n<tr>\n<td><code>gdpr_consent</code></td>\n<td>URL-safe base64-encoded GDPR consent string</td>\n<td>This parameter should only be passed if <code>gdpr</code> has a value of <code>1</code> and <code>gdpr_consent</code> is not an empty string.</td>\n</tr>\n<tr>\n<td><code>gdpr_pd</code></td>\n<td><code>0</code> / <code>1</code></td>\n<td>This parameter is optional and determines if personal data is included. Value of <code>1</code> means <code>yes</code>, default value of <code>0</code> means <code>no</code>.</td>\n</tr>\n</tbody>\n</table>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>Other personal data, such as IP addresses or tracking pixel cookies, may be passed as part of the request. The <code>gdpr</code> and <code>gdpr_consent</code> parameters should be used by the callee to determine whether an identifier cookie or other personal data can be set and/or used.</p>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/industries/tealium-identity-partners/acxiom-identity-resolution/",
            "title": "Using Tealium Functions for Acxiom Identity Resolution",
            "body": "<p>We recommend using a visitor function to capture the data from Acxiom. For more information on visitor functions, see <a href=\"/server-side/functions/event-visitor-functions/about/\">Event and Visitor Functions</a>.</p>\n<p>The visitor function does the following:</p>\n<ul>\n<li>Requests the additional data from Acxiom.</li>\n<li>Sends an event containing the additional data and <code>tealium_visitor_id</code> to Tealium Collect.</li>\n</ul>\n<p>The EventStream attributes and visitor attributes are enriched by the event sent from the function.</p>\n<h2 id=\"prerequisites\">Prerequisites</h2>\n<ul>\n<li>Tealium EventSteam and Tealium Functions.</li>\n<li>The Tealium Collect API as a data source.</li>\n<li>Visitor attributes to store the additional information.</li>\n<li>An event specification titled <code>acxiom_function_event</code> with the attributes required to enrich the visitor attributes.</li>\n<li>An enrichment to set the visitor attributes to the value of the event attributes.</li>\n</ul>\n<p>The function works best when the Acxiom Real Tag tag is installed. This identifier increases the confidence rating for the visitor.</p>\n<h2 id=\"creating-a-function-to-process-the-event\">Creating a function to process the event</h2>\n<p>To create the function:</p>\n<ol>\n<li>Navigate to <strong>Functions</strong>.</li>\n<li>Click <strong>Add Function</strong>.</li>\n<li>Enter a name for the function.</li>\n<li>Enter notes to describe the function.</li>\n<li>Select the <strong>Processed Event</strong> trigger.</li>\n<li>Select the event feed for the trigger.</li>\n<li>Click <strong>Continue</strong>.</li>\n<li>Enter the sample code below into the <strong>Code</strong> box.</li>\n<li>Customize the code as necessary for your configuration.</li>\n<li>Save the function.</li>\n</ol>\n<p>You can test the function with the <strong>Test</strong> feature and a tool such as Postman API Workbench.</p>\n<p>For more information on creating a function, see <a href=\"/server-side/functions/manage-functions/create-function/\">Managing Functions</a>.</p>\n<h2 id=\"example-function-code\">Example function code</h2>\n<p>The test example function included below attempts to match a visitor profile based off of the attributes you send to it:</p>\n<table>\n<thead>\n<tr>\n<th>Attribute</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>acxiom_function_event</code></td>\n<td>Event Spec name</td>\n</tr>\n<tr>\n<td><code>realId</code></td>\n<td>Acxiom rTag</td>\n</tr>\n<tr>\n<td><code>address</code></td>\n<td>User’s address</td>\n</tr>\n<tr>\n<td><code>phone</code></td>\n<td>User’s phone number</td>\n</tr>\n<tr>\n<td><code>email</code></td>\n<td>User’s email address</td>\n</tr>\n<tr>\n<td><code>fullName</code></td>\n<td>User’s full name</td>\n</tr>\n</tbody>\n</table>\n<p>The function returns any additional user data for profile enrichment.</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>This code is currently in beta.</p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;\"><code class=\"language-js\" data-lang=\"js\"><span style=\"display:flex;\"><span><span style=\"color:#75715e\">// In an event scoped function, the following modules are available for use: event, auth\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span><span style=\"color:#66d9ef\">import</span> { <span style=\"color:#a6e22e\">event</span>, <span style=\"color:#a6e22e\">store</span>, <span style=\"color:#a6e22e\">tealium</span> } <span style=\"color:#a6e22e\">from</span> <span style=\"color:#e6db74\">&#34;tealium&#34;</span>;\n</span></span><span style=\"display:flex;\"><span>(<span style=\"color:#66d9ef\">async</span> () =&gt; {\n</span></span><span style=\"display:flex;\"><span>    \n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// These endpoints will be specific to your setup with Acxiom.\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">access_url</span><span style=\"color:#f92672\">=</span><span style=\"color:#e6db74\">&#34;https://mydomain.com/metrics/access_token&#34;</span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">query_url</span><span style=\"color:#f92672\">=</span><span style=\"color:#e6db74\">&#34;https://mydomain.com/metrics&#34;</span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">query_name</span><span style=\"color:#f92672\">=</span><span style=\"color:#e6db74\">&#34;demo_dsapi_match&#34;</span>\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// Uncomment this to find out exactly what is available to use in your event object\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#75715e\">//console.log(&#39;Data available:\\n&#39;, JSON.stringify(event, null, 2));\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">data</span> <span style=\"color:#f92672\">=</span> {};\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">tealium_account</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">udo</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">tealium_account</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">tealium_profile</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">udo</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">tealium_profile</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">visitor_id</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">udo</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">visitor_id</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">trace_id</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">firstparty_tealium_cookies</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">trace_id</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">acxiom_real_id</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">udo</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">acxiom_real_id</span> <span style=\"color:#f92672\">||</span> <span style=\"color:#e6db74\">&#34;&#34;</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">customer_email</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">udo</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">customer_email</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">customer_first_name</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">udo</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">customer_first_name</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">customer_last_name</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">udo</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">customer_last_name</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">customer_full_name</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">`</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">customer_first_name</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\"> </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">customer_last_name</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">`</span>\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// Check if acxiom_real_id is available\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#75715e\">// if (typeof data.acxiom_real_id === &#34;undefined&#34;) {\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#75715e\">//     console.error(&#34;acxiom_entity_id is unavailable.&#34;);\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#75715e\">//     return;\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#75715e\">// }\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// Pull in refresh token from global variables\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">refresh_token</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">store</span>.<span style=\"color:#a6e22e\">get</span>(<span style=\"color:#e6db74\">&#34;acxiom_refresh_token&#34;</span>)\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#34;refresh_token: &#34;</span>, <span style=\"color:#a6e22e\">refresh_token</span>)\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// Generate access token\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">access_token_request</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">fetch</span>(<span style=\"color:#a6e22e\">access_url</span>, {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">method</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;POST&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">headers</span><span style=\"color:#f92672\">:</span> {\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#e6db74\">&#34;Content-Type&#34;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;application/json&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#e6db74\">&#34;Authorization&#34;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">`Bearer </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">refresh_token</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">`</span>\n</span></span><span style=\"display:flex;\"><span>        },\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">body</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">`{&#34;grant_type&#34;:&#34;refresh_token&#34;,&#34;refresh_token&#34;:&#34;</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">refresh_token</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">&#34;}`</span>\n</span></span><span style=\"display:flex;\"><span>    })\n</span></span><span style=\"display:flex;\"><span>    .<span style=\"color:#66d9ef\">catch</span>((<span style=\"color:#a6e22e\">error</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#e6db74\">&#39;Error:&#39;</span>, <span style=\"color:#a6e22e\">error</span>);\n</span></span><span style=\"display:flex;\"><span>    });\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">access_token_response</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">access_token_request</span>.<span style=\"color:#a6e22e\">json</span>();\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// console.log(&#34;access_token_response:&#34;, JSON.stringify(access_token_response));\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">access_token</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">access_token_response</span>.<span style=\"color:#a6e22e\">jwt_token</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// console.log(&#34;access_token: &#34;, access_token)\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// Fetch query_execution_id from Acxiom PAIL with acxiom_real_id\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">response</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">fetch</span>(<span style=\"color:#e6db74\">`</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">query_url</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">/named_queries/</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">query_name</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">/execute`</span>, {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">method</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;POST&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">redirect</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;follow&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">headers</span><span style=\"color:#f92672\">:</span> {\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#e6db74\">&#34;Content-Type&#34;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;application/json&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#e6db74\">&#34;Authorization&#34;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">`Bearer </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">access_token</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">`</span>\n</span></span><span style=\"display:flex;\"><span>        },\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">body</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">`{\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">            &#34;realID&#34;: &#34;</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">acxiom_real_id</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">&#34;, \n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">            &#34;address&#34;: &#34;</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">customer_address</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">&#34;, \n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">            &#34;phone&#34;: &#34;</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">customer_phone</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">&#34;, \n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">            &#34;email&#34;: &#34;</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">customer_email</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">&#34;, \n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">            &#34;fullName&#34;: &#34;</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">customer_full_name</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">&#34;\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\">        }`</span>\n</span></span><span style=\"display:flex;\"><span>    })\n</span></span><span style=\"display:flex;\"><span>    .<span style=\"color:#a6e22e\">then</span>(<span style=\"color:#a6e22e\">res</span> =&gt; {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#34;Res: &#34;</span>, <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">res</span>))\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">res</span>\n</span></span><span style=\"display:flex;\"><span>    })\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// .then(response =&gt; console.log(&#34;Response: &#34;, JSON.stringify(response)))\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    .<span style=\"color:#66d9ef\">catch</span>(<span style=\"color:#a6e22e\">error</span> =&gt; <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#e6db74\">&#39;Error: &#39;</span>, <span style=\"color:#a6e22e\">error</span>.<span style=\"color:#a6e22e\">message</span>));\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">body</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">json</span>();\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">query_execution_id</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">body</span>.<span style=\"color:#a6e22e\">query_execution_id</span>\n</span></span><span style=\"display:flex;\"><span>    \n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// console.log(&#34;Status: &#34; + response.status);\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#34;Body: &#34;</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">body</span>, <span style=\"color:#66d9ef\">null</span>, <span style=\"color:#ae81ff\">2</span>));\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// Check if Acxiom response data is available\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">ok</span>) {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#e6db74\">&#34;Acxiom response data is unavailable.&#34;</span>);\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#66d9ef\">return</span>;\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// Fetch data from Acxiom PAIL with query_execution_id\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">payload</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">fetch</span>(<span style=\"color:#e6db74\">`</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">query_url</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">/query_executions/</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">query_execution_id</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">`</span>, {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">method</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;GET&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">headers</span><span style=\"color:#f92672\">:</span> {\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#e6db74\">&#34;Content-Type&#34;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#34;application/json&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#e6db74\">&#34;Authorization&#34;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">`Bearer </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">access_token</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">`</span>\n</span></span><span style=\"display:flex;\"><span>        }\n</span></span><span style=\"display:flex;\"><span>    })\n</span></span><span style=\"display:flex;\"><span>    .<span style=\"color:#a6e22e\">then</span>(<span style=\"color:#a6e22e\">res</span> =&gt; {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#34;Res: &#34;</span>, <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">res</span>))\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">res</span>\n</span></span><span style=\"display:flex;\"><span>    })\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// .then(response =&gt; response.json())\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#75715e\">// .then(response =&gt; console.log(&#34;Response: &#34;, JSON.stringify(response)))\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    .<span style=\"color:#66d9ef\">catch</span>(<span style=\"color:#a6e22e\">err</span> =&gt; <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#a6e22e\">err</span>));\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">user_data</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">payload</span>.<span style=\"color:#a6e22e\">json</span>();\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#34;user_data: &#34;</span>, <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">user_data</span>))\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">data_object</span> <span style=\"color:#f92672\">=</span> {};\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">for</span> (<span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">i</span><span style=\"color:#f92672\">=</span><span style=\"color:#ae81ff\">0</span>; <span style=\"color:#a6e22e\">i</span> <span style=\"color:#f92672\">&lt;</span> <span style=\"color:#a6e22e\">user_data</span>.<span style=\"color:#a6e22e\">column_info</span>.<span style=\"color:#a6e22e\">length</span>; <span style=\"color:#a6e22e\">i</span><span style=\"color:#f92672\">++</span>) {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#a6e22e\">data_object</span>[<span style=\"color:#a6e22e\">user_data</span>.<span style=\"color:#a6e22e\">column_info</span>[<span style=\"color:#a6e22e\">i</span>].<span style=\"color:#a6e22e\">name</span>] <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">user_data</span>.<span style=\"color:#a6e22e\">data</span>[<span style=\"color:#ae81ff\">0</span>][<span style=\"color:#a6e22e\">i</span>]\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// data_object = JSON.stringify(data_object)\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">newEvent</span> <span style=\"color:#f92672\">=</span> {};\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">newEvent</span> <span style=\"color:#f92672\">=</span> { ...<span style=\"color:#a6e22e\">data_object</span> }\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">newEvent</span>.<span style=\"color:#a6e22e\">tealium_event</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#34;acxiom_function_event&#34;</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">newEvent</span>.<span style=\"color:#a6e22e\">visitor_id</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">visitor_id</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">newEvent</span>.<span style=\"color:#a6e22e\">tealium_trace_id</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">data</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">tealium_trace_id</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">newEvent</span>.<span style=\"color:#a6e22e\">customer_email</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">data_object</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">email</span>;\n</span></span><span style=\"display:flex;\"><span>    \n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#34;newEvent: &#34;</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">newEvent</span>, <span style=\"color:#66d9ef\">null</span>, <span style=\"color:#ae81ff\">2</span>));\n</span></span><span style=\"display:flex;\"><span>\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#75715e\">// Send data received from Acxiom to Tealium\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#a6e22e\">tealium</span>\n</span></span><span style=\"display:flex;\"><span>        .<span style=\"color:#a6e22e\">sendCollectEvent</span>(<span style=\"color:#a6e22e\">newEvent</span>, <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">tealium_account</span>, <span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">tealium_profile</span>)\n</span></span><span style=\"display:flex;\"><span>        .<span style=\"color:#a6e22e\">then</span>(<span style=\"color:#a6e22e\">response</span> =&gt; {\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;Status code: &#39;</span>, <span style=\"color:#a6e22e\">response</span>.<span style=\"color:#a6e22e\">status</span>);\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">response</span>;\n</span></span><span style=\"display:flex;\"><span>        })\n</span></span><span style=\"display:flex;\"><span>        .<span style=\"color:#a6e22e\">then</span>(<span style=\"color:#a6e22e\">data</span> =&gt; <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;Result: &#39;</span>, <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">data</span>, <span style=\"color:#66d9ef\">null</span>, <span style=\"color:#ae81ff\">2</span>)))\n</span></span><span style=\"display:flex;\"><span>        .<span style=\"color:#66d9ef\">catch</span>(<span style=\"color:#a6e22e\">error</span> =&gt; <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">error</span>(<span style=\"color:#e6db74\">&#39;Error: &#39;</span>, <span style=\"color:#a6e22e\">error</span>.<span style=\"color:#a6e22e\">message</span>));\n</span></span><span style=\"display:flex;\"><span>})();\n</span></span></code></pre></div>"
        }  

    ]
}
