
{
    "kind": "term",
    "name": "Tealium for AI",
    "count": 9,
    "items": [

    
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/guides/function-for-ai-activation/",
            "title": "Create a function for AI activation",
            "body": "<p>This guide explains how to integrate external AI models with Tealium functions for real-time activation. Connect securely to model endpoints, invoke AI predictions using event and visitor data, and enrich visitor profiles with model outputs. It also covers asynchronous responses and common integration issues.</p>\n<p>For information on when to use Tealium functions or AI connectors for your use case, see <a href=\"/guides/ai-connectors-and-functions/\">AI connectors and Tealium functions</a>.</p>\n<h2 id=\"how-it-works\">How it works</h2>\n<p>Use functions to call external AI models for tasks such as churn risk, fraud detection, propensity scoring, or next-best-action recommendations. The function collects event data and visitor profile attributes, builds a payload, sends it to your model endpoint, receives a prediction, and updates the visitor profile for activation.</p>\n<p>The data flow for real-time model inference and activation includes the following steps:</p>\n<ol>\n<li><strong>Customer action</strong>: User performs an action (for example, view product, add to cart, submit form).</li>\n<li><strong>Function trigger</strong>: An event or visitor function fires based on configured triggers and returns a prediction (score, classification, recommendation).</li>\n<li><strong>Event to Collect</strong>: The function sends prediction data to Tealium Collect through the <code>track()</code> method.</li>\n<li><strong>Enrichment processing</strong>: Configured enrichments write the prediction values to visitor profile attributes.</li>\n<li><strong>Downstream activation</strong>: Audiences evaluate and connectors fire based on updated profile attributes.</li>\n</ol>\n<p>Because functions cannot directly modify visitor profiles, predictions must flow through Tealium Collect and be written to profiles through enrichments.</p>\n<p>The <code>track()</code> method sends events to Tealium Collect. You must configure enrichments to write these event attribute values to visitor profile attributes.</p>\n<h3 id=\"function-types\">Function types</h3>\n<table>\n<thead>\n<tr>\n<th>Function type</th>\n<th>Trigger</th>\n<th>Signature</th>\n<th>Use case</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Event Function</td>\n<td>Fires after a specific event is processed</td>\n<td><code>{ event, helper }</code></td>\n<td>Score based on immediate event context (for example, product recommendation on product view)</td>\n</tr>\n<tr>\n<td>Visitor Function</td>\n<td>Fires after a visitor profile is updated</td>\n<td><code>{ visitor, visit, helper }</code></td>\n<td>Score based on accumulated profile data (for example, churn prediction based on engagement history)</td>\n</tr>\n</tbody>\n</table>\n<p>Using functions to call external AI models for real-time inference and activation provides several benefits, such as:</p>\n<ul>\n<li>Detect customer churn risk from visitor behavior in real time.</li>\n<li>Improve targeting for retention campaigns by identifying high-risk visitors.</li>\n<li>Support personalized experiences by using AI-based predictions for segmentation.</li>\n<li>Increase accuracy of downstream activation by enriching profiles with model-driven insights.</li>\n<li>Handle high-throughput data streams for timely analysis and response.</li>\n<li>Improve data quality for marketing, analytics, and compliance workflows.</li>\n</ul>\n<h3 id=\"prerequisites\">Prerequisites</h3>\n<p>Before you create a function to invoke your AI model, ensure that you have the following:</p>\n<ul>\n<li>A trained ML model deployed to a REST API endpoint, such as Snowflake Cortex, Databricks Model Serving, AWS SageMaker, Google Vertex AI, Azure ML, Hugging Face Inference Endpoints, or any HTTPS endpoint.</li>\n<li>API credentials for your model endpoint, such as API key, bearer token, or JWT.</li>\n<li>Add Tealium IP addresses for your profile region to the allowlist for your data cloud. For more information, see <a href=\"/administration/security-access/ip-allow-list/\">Tealium IP addresses to allow</a>.</li>\n<li>The request payload schema your model expects.</li>\n<li>The response payload schema your model returns.</li>\n</ul>\n<h2 id=\"key-components-for-ai-based-churn-risk-analysis\">Key components for AI-based churn risk analysis</h2>\n<ul>\n<li>\n<p><strong>Data transformation function</strong><br>\nEvaluates incoming event data and applies regular expressions to identify behaviors relevant to churn risk.</p>\n</li>\n<li>\n<p><strong>Derived attribute</strong><br>\nCalculates a churn risk score from event data. The function sets this value for each event.</p>\n</li>\n<li>\n<p><strong>AudienceStream event filter</strong><br>\nFilters events using the churn risk score. Only high-risk events enrich visitor profiles.</p>\n</li>\n<li>\n<p><strong>Event feed</strong><br>\nStreams flagged high-risk events for further processing by connectors, storage, or other functions.</p>\n</li>\n<li>\n<p><strong>External model invocation function</strong><br>\nSends enriched event or profile data to an external AI model endpoint for advanced churn prediction.</p>\n</li>\n<li>\n<p><strong>Enrichment</strong><br>\nWrites AI model predictions to visitor profile attributes for activation and segmentation.</p>\n</li>\n</ul>\n<h2 id=\"requirements\">Requirements</h2>\n<p>To implement this solution, you need:</p>\n<ul>\n<li>Tealium requirements\n<ul>\n<li>AudienceStream enabled</li>\n<li>Tealium functions enabled</li>\n<li>A configured data source for receiving <code>track()</code> events</li>\n<li>Enrichments to write prediction attributes to visitor profiles</li>\n</ul>\n</li>\n<li>Model endpoint requirements\n<ul>\n<li>Use HTTPS protocol</li>\n<li>Responds within 10 seconds. We recommend a response time of under 500 milliseconds for real-time personalization.</li>\n<li>Uses a bearer token, API key, or header-based authentication</li>\n<li>Responds in JSON format.</li>\n</ul>\n</li>\n</ul>\n<h2 id=\"step-1-create-the-function\">Step 1: Create the function</h2>\n<p>You can implement your AI activation logic using either an event function or a visitor function. Choose the function type that best matches your use case and the data available at the time of scoring.</p>\n<h3 id=\"code-reference\">Code reference</h3>\n<table>\n<thead>\n<tr>\n<th>Object/Method</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>event.data.udo.*</code></td>\n<td>Event attributes from the triggering event</td>\n</tr>\n<tr>\n<td><code>visitor.properties.*</code></td>\n<td>Visitor profile string attributes</td>\n</tr>\n<tr>\n<td><code>visitor.metrics.*</code></td>\n<td>Visitor profile numeric attributes</td>\n</tr>\n<tr>\n<td><code>visitor.audiences</code></td>\n<td>Visitor audience membership</td>\n</tr>\n<tr>\n<td><code>visitor.current_visit.*</code></td>\n<td>Visit attributes from the visitor’s current session</td>\n</tr>\n<tr>\n<td><code>helper.getAuth('name')</code></td>\n<td>Retrieve stored authentication token</td>\n</tr>\n<tr>\n<td><code>helper.getGlobalVariable('name')</code></td>\n<td>Retrieve stored global variable</td>\n</tr>\n<tr>\n<td><code>track(data, config)</code></td>\n<td>Send event to Tealium Collect (max 6 calls per invocation)</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"platform-specific-notes\">Platform-specific notes</h3>\n<p>The following code examples show a generic REST API pattern. Actual implementations vary by platform:</p>\n<table>\n<thead>\n<tr>\n<th>Platform</th>\n<th>Notes</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Snowflake Cortex</td>\n<td>Cortex functions are called through SQL statements using the Snowflake SQL API. Requires JWT authentication.</td>\n</tr>\n<tr>\n<td>Databricks Model Serving</td>\n<td>MLflow models are exposed as REST endpoints. Uses personal access token (PAT) authentication. Supports asynchronous inference through jobs API.</td>\n</tr>\n<tr>\n<td>AWS SageMaker</td>\n<td>Endpoints require AWS Signature V4 authentication. Consider using a Lambda proxy for simplified authentication. Supports async inference endpoints for long-running jobs.</td>\n</tr>\n<tr>\n<td>Hugging Face</td>\n<td>Inference Endpoints use bearer token authentication. Response format depends on the model type.</td>\n</tr>\n<tr>\n<td>GCP Vertex</td>\n<td>Vertex AI endpoints use OAuth 2.0 or service account authentication.</td>\n</tr>\n<tr>\n<td>Azure</td>\n<td>Azure ML managed endpoints use API key or Azure AD token authentication.</td>\n</tr>\n</tbody>\n</table>\n<p>Refer to your platform&rsquo;s API documentation for request/response formats and authentication requirements.</p>\n<h3 id=\"event-function-example\">Event function example</h3>\n<p>The following example shows how to call an external model API from an event function. Adapt the payload structure and response parsing to match your model&rsquo;s API.</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:#a6e22e\">activate</span>(<span style=\"color:#66d9ef\">async</span> ({ <span style=\"color:#a6e22e\">event</span>, <span style=\"color:#a6e22e\">helper</span> }) =&gt; {\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">// 1. Assemble feature payload from event data\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#75715e\">// Adapt this to match your model&#39;s expected input format\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> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">product_id</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">event</span>.<span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">udo</span>.<span style=\"color:#a6e22e\">product_id</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">category</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">event</span>.<span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">udo</span>.<span style=\"color:#a6e22e\">product_category</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">price</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">event</span>.<span style=\"color:#a6e22e\">data</span>.<span style=\"color:#a6e22e\">udo</span>.<span style=\"color:#a6e22e\">product_price</span>\n</span></span><span style=\"display:flex;\"><span>  };\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">// 2. Call your model API\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>(\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getGlobalVariable</span>(<span style=\"color:#e6db74\">&#39;MODEL_ENDPOINT_URL&#39;</span>),\n</span></span><span style=\"display:flex;\"><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\">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\">&#39;Bearer &#39;</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getAuth</span>(<span style=\"color:#e6db74\">&#39;model_api_token&#39;</span>),\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">&#39;Content-Type&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;application/json&#39;</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:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">payload</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:#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\">&#39;Model API error:&#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>;\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\">result</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:#75715e\">// 3. Send prediction to Tealium Collect\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#75715e\">// Adapt the attribute names to match your model&#39;s response\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#a6e22e\">track</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\">&#39;model_prediction&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">prediction_score</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">result</span>.<span style=\"color:#a6e22e\">score</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">prediction_label</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">result</span>.<span style=\"color:#a6e22e\">label</span>\n</span></span><span style=\"display:flex;\"><span>  }, {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_account</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">event</span>.<span style=\"color:#a6e22e\">account</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_profile</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">event</span>.<span style=\"color:#a6e22e\">profile</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_datasource</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getGlobalVariable</span>(<span style=\"color:#e6db74\">&#39;DATASOURCE_KEY&#39;</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<h3 id=\"visitor-function-example\">Visitor function example</h3>\n<p>Visitor functions can access accumulated profile data for scoring. However, visitor functions do not have access to the <code>event</code> object, so you must use global variables for <code>account</code>, <code>profile</code>, and <code>datasource</code> values.</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:#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:#75715e\">// Assemble payload from visitor profile 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\">payload</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">lifetime_value</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">metrics</span>.<span style=\"color:#a6e22e\">lifetime_value</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">purchase_count</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">metrics</span>.<span style=\"color:#a6e22e\">purchase_count</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">days_since_last_purchase</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">metrics</span>.<span style=\"color:#a6e22e\">days_since_last_purchase</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">loyalty_tier</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">properties</span>.<span style=\"color:#a6e22e\">loyalty_tier</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>(\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getGlobalVariable</span>(<span style=\"color:#e6db74\">&#39;MODEL_ENDPOINT_URL&#39;</span>),\n</span></span><span style=\"display:flex;\"><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\">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\">&#39;Bearer &#39;</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getAuth</span>(<span style=\"color:#e6db74\">&#39;model_api_token&#39;</span>),\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">&#39;Content-Type&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;application/json&#39;</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:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">payload</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:#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\">&#39;Model API error:&#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>;\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\">result</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:#75715e\">// For Visitor Functions, use Global Variables for routing\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#75715e\">// Include visitor_id to ensure the event stitches to the correct profile\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#a6e22e\">track</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\">&#39;churn_prediction&#39;</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\">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:#a6e22e\">churn_score</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">result</span>.<span style=\"color:#a6e22e\">churn_probability</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">churn_risk_tier</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">result</span>.<span style=\"color:#a6e22e\">risk_tier</span>\n</span></span><span style=\"display:flex;\"><span>  }, {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">tealium_account</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getGlobalVariable</span>(<span style=\"color:#e6db74\">&#39;TEALIUM_ACCOUNT&#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:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getGlobalVariable</span>(<span style=\"color:#e6db74\">&#39;TEALIUM_PROFILE&#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:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getGlobalVariable</span>(<span style=\"color:#e6db74\">&#39;DATASOURCE_KEY&#39;</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<h3 id=\"slow-model-response-handling\">Slow model response handling</h3>\n<p>When model inference takes longer than 10 seconds, use an asynchronous pattern. The function sends a request and exits immediately. The model calls back to Tealium when processing completes.</p>\n<ol>\n<li>Function sends visitor data and a callback URL to your model endpoint</li>\n<li>Model endpoint returns 202 Accepted immediately</li>\n<li>Function exits (no timeout)</li>\n<li>Model completes inference asynchronously</li>\n<li>Model POSTs prediction to Tealium&rsquo;s HTTP API</li>\n<li>Enrichments write prediction to visitor profile</li>\n</ol>\n<h4 id=\"create-an-http-api-data-source-for-the-model-callback\">Create an HTTP API data source for the model callback</h4>\n<p>Create an HTTP API data source for receiving model callbacks. For more information, see <a href=\"/server-side/data-sources/create-data-source/\">Create a data source</a>.</p>\n<h3 id=\"async-function-code\">Async function code</h3>\n<p>Use the following function code:</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:#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\">payload</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">visitor_id</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:#a6e22e\">lifetime_value</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">metrics</span>.<span style=\"color:#a6e22e\">lifetime_value</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">purchase_count</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">visitor</span>.<span style=\"color:#a6e22e\">metrics</span>.<span style=\"color:#a6e22e\">purchase_count</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">callback_url</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getGlobalVariable</span>(<span style=\"color:#e6db74\">&#39;TEALIUM_CALLBACK_URL&#39;</span>),\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">callback_datasource</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getGlobalVariable</span>(<span style=\"color:#e6db74\">&#39;DATASOURCE_KEY&#39;</span>)\n</span></span><span style=\"display:flex;\"><span>  };\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">// Fire and forget - don&#39;t await the response\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#a6e22e\">fetch</span>(\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getGlobalVariable</span>(<span style=\"color:#e6db74\">&#39;MODEL_ENDPOINT_URL&#39;</span>),\n</span></span><span style=\"display:flex;\"><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\">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\">&#39;Bearer &#39;</span> <span style=\"color:#f92672\">+</span> <span style=\"color:#a6e22e\">helper</span>.<span style=\"color:#a6e22e\">getAuth</span>(<span style=\"color:#e6db74\">&#39;model_api_token&#39;</span>),\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">&#39;Content-Type&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;application/json&#39;</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:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</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\">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;Request failed:&#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:#75715e\">// Function exits immediately - model will callback when ready\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>});\n</span></span></code></pre></div>\n    </div>\n</div>\n</div>\n<h3 id=\"model-callback-payload\">Model callback payload</h3>\n<p>Your model endpoint should POST to the Tealium HTTP API when inference completes:</p>\n<pre tabindex=\"0\"><code>POST https://collect.tealiumiq.com/event?tealium_account={account}&amp;tealium_profile={profile}&amp;tealium_datasource={datasource_key}\n\n{\n  &#34;tealium_event&#34;: &#34;model_prediction_complete&#34;,\n  &#34;tealium_visitor_id&#34;: &#34;original_visitor_id_from_request&#34;,\n  &#34;churn_score&#34;: 0.82,\n  &#34;churn_risk_tier&#34;: &#34;high&#34;,\n  &#34;model_version&#34;: &#34;v2.1&#34;\n}\n</code></pre><p>Including <code>tealium_visitor_id</code> ensures the prediction stitches to the correct visitor profile. Configure enrichments as described in Step 3 to write these attributes to the profile.</p>\n<h2 id=\"step-2-configure-credentials-for-the-ml-platform\">Step 2: Configure credentials for the ML platform</h2>\n<p>Store your model API credentials and configuration in Tealium functions for secure access.</p>\n<h3 id=\"add-authentication-tokens-for-the-ml-platform\">Add authentication tokens for the ML platform</h3>\n<p>To store API credentials for a function on the Tealium platform, add an authentication token. In this example, you will store the API key or token endpoint URL as <code>model_api_token</code>. For more information, see <a href=\"/server-side/functions/event-visitor-functions/authentication/\">Add authentication</a>.</p>\n<p>Retrieve the token in your function with the following code:</p>\n<pre tabindex=\"0\"><code>    {\n      method: &#39;POST&#39;,\n      headers: {\n        &#39;Authorization&#39;: &#39;Bearer &#39; + helper.getAuth(&#39;model_api_token&#39;),\n        &#39;Content-Type&#39;: &#39;application/json&#39;\n      },\n      body: JSON.stringify(payload)\n    }\n</code></pre><p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>Authentication tokens can only be referenced by a function within an HTTP request. If you try to reference the token outside of an HTTP request, the token is replaced by a UUID placeholder.</p>\n<h3 id=\"add-global-variables-for-the-ml-platform\">Add global variables for the ML platform</h3>\n<p>Store configuration information for a function such as the model endpoint URL and name as global variables. In this example, you will store the model endpoint URL as <code>MODEL_ENDPOINT_URL</code>. For more information, see <a href=\"/server-side/functions/manage-functions/manage-global-variables/\">Manage global variables</a>.</p>\n<p>Retrieve the variable in your function with the following code:</p>\n<pre tabindex=\"0\"><code>  const response = await fetch(\n    helper.getGlobalVariable(&#39;MODEL_ENDPOINT_URL&#39;),\n    {\n...\n    }\n  );\n</code></pre><h2 id=\"step-3-add-churn-score-to-visitor-profile\">Step 3: Add churn score to visitor profile</h2>\n<p>Before you can activate predictions in downstream systems, you must configure attributes and enrichments to store and process model outputs in visitor profiles.</p>\n<h3 id=\"create-churn-score-profile-attribute\">Create churn score profile attribute</h3>\n<p>Create an attribute to store model predictions in visitor profiles. In this example, create a <code>churn_score</code> number attribute.</p>\n<p>For more information, see <a href=\"/server-side/attributes/manage-as-attributes/#create-an-attribute\">Create an attribute</a>.</p>\n<p>Enrich the attribute you created to write model predictions from events to visitor profiles. Without an enrichment, predictions do not appear on visitor profiles. In this example, create an enrichment to write the <code>prediction_score</code> event attribute from your <code>track()</code> call to the <code>churn_score</code> visitor attribute when <code>tealium_event</code> equals <code>model_prediction</code> (or your event name).</p>\n<div class=\"mv3 pv2 ph4 ba br2 b--light-gray\">\n  <div class=\"boolean-logic-container\">\n      <div class=\"condition-group\">\n        <span class=\"input\">tealium_event</span>\n        <span class=\"operator\">EQUALS (IGNORE CASE)</span>\n        <span class=\"filter\">model_prediction</span>\n      </div>\n  </div>\n</div>\n<p>For more information, see <a href=\"/server-side/attributes/manage-enrichments/add-enrichment/\">Add enrichment</a>.</p>\n<h2 id=\"step-4-activate-a-high-churn-risk-audience\">Step 4: Activate a high churn risk audience</h2>\n<p>Use your prediction attributes to build audiences and trigger actions to activate on churn risk.</p>\n<h3 id=\"create-churn-risk-audience\">Create churn risk audience</h3>\n<p>Create an audience based on prediction attributes. In this example, create a <code>High Churn Risk</code> audience for visitors with a <code>churn_score</code> greater than <code>0.7</code>.</p>\n<div class=\"mv3 pv2 ph4 ba br2 b--light-gray\">\n  <div class=\"boolean-logic-container\">\n      <div class=\"condition-group\">\n        <span class=\"input\">churn_score</span>\n        <span class=\"operator\">GREATER THAN</span>\n        <span class=\"filter\">0.7</span>\n      </div>\n  </div>\n</div>\n<p>For more information, see <a href=\"/server-side/audiences/manage/#create-an-audience\">Create an audience</a>.</p>\n<h3 id=\"configure-connectors\">Configure connectors</h3>\n<p>Attach connector actions to audiences to activate on prediction values. In this example, you can trigger retention emails for high churn risk or add users to remarketing audiences based on purchase intent.</p>\n<p>For more information, see <a href=\"/server-side/connectors/add/\">Add connector</a>.</p>\n<h2 id=\"debugging\">Debugging</h2>\n<h3 id=\"view-logs\">View logs</h3>\n<p>Use <code>console.log()</code> for debugging:</p>\n<pre tabindex=\"0\"><code>console.log(&#39;Payload:&#39;, JSON.stringify(payload));\nconsole.log(&#39;Response status:&#39;, response.status);\nconsole.log(&#39;Result:&#39;, JSON.stringify(result));\n</code></pre><p>To view logs, click the <strong>Logs</strong> tab in the functions editor.</p>\n<h3 id=\"common-issues\">Common issues</h3>\n<table>\n<thead>\n<tr>\n<th>Issue</th>\n<th>Solution</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Function times out</td>\n<td>Ensure model responds within 10 seconds. Use dedicated or provisioned endpoints. Consider asynchronous model invocation depending on average model response time.</td>\n</tr>\n<tr>\n<td>Predictions not on profiles</td>\n<td>Verify enrichments are configured. Check <code>tealium_datasource</code> value.</td>\n</tr>\n<tr>\n<td>Authentication errors</td>\n<td>Verify token value in <strong>Auth Tokens</strong>. Check token expiration.</td>\n</tr>\n<tr>\n<td><code>track()</code> not executing</td>\n<td>Check for errors before <code>track()</code>. Verify data source is active.</td>\n</tr>\n</tbody>\n</table>\n<h2 id=\"resources\">Resources</h2>\n<ul>\n<li><a href=\"/server-side/functions/about/\">Functions</a></li>\n</ul>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/guides/ai-connectors-and-functions/",
            "title": "AI connectors and Tealium functions overview",
            "body": "<p>Tealium supports two approaches for integrating AI models into real-time data workflows:</p>\n<ul>\n<li><strong>AI connectors</strong>: Integrate with supported large language model (LLM) providers for prompt-based interactions.</li>\n<li><strong>Tealium functions</strong>: Invoke your own model or call custom endpoints.</li>\n</ul>\n<p>Use this guide to understand how each approach works and when to use each one.</p>\n<h2 id=\"ai-connectors\">AI connectors</h2>\n<h3 id=\"how-it-works\">How it works</h3>\n<p>AI connectors integrate with hosted LLM APIs from supported providers and require prompt-based interactions that return structured JSON. They follow a consistent prompt, response, and activation pattern across all supported providers.</p>\n<p>To use an AI connector, you need authentication credentials for your provider and at least one configured action that defines a prompt and the Tealium data to send to the AI model.</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>AI connectors are designed for LLM activation only. They are not intended for invoking traditional machine learning models that return numeric scores or tabular predictions. For those use cases, use Tealium functions.</p>\n<h3 id=\"data-flow\">Data flow</h3>\n<figure class=\"tc\"><a class=\"slb\" href=\"/images/guides/ai-connectors-flow.png\"><img src=\"https://docs.tealium.com/images/guides/ai-connectors-flow.png\"\n         alt=\"AI connectors data flow\"\n         title=\"AI connectors data flow\" width=\"30%\"/>\n    </a>\n</figure>\n<ol>\n<li><strong>Trigger fires</strong>: An event or audience change triggers a connector action.</li>\n<li><strong>Prompt sent</strong>: The connector sends your prompt and Tealium data to the AI model endpoint.</li>\n<li><strong>Response received</strong>: The model generates the requested values and returns a JSON object.</li>\n<li><strong>Event ingested</strong>: The connector forwards the response to Tealium Collect.</li>\n<li><strong>Profile enriched</strong>: Enrichment rules write the response values to visitor profile attributes.</li>\n<li><strong>Audiences activate</strong>: Audience rules evaluate the updated attributes and downstream connectors fire.</li>\n</ol>\n<h3 id=\"prompts\">Prompts</h3>\n<p>The prompt instructs the model about the context data to evaluate, asks a specific question, and defines the expected response. Depending on the vendor connector, you may or may not need to include specific instructions about the response output. See the specific connector instructions for details.</p>\n<h4 id=\"context-data\">Context data</h4>\n<p>You can include specific attributes or the entire event or visitor data object as context in the prompt.</p>\n<p>To include specific attributes, map them in the connector action then reference them in the prompt. For example, if you map <code>product_review</code>, you can reference <code>{{product_review}}</code> in your prompt.</p>\n<p>To include entire data objects in the prompt, enable <strong>Add Event Payload</strong> or <strong>Add Visitor Profile</strong> in the connector action settings, then reference <code>{{event_payload}}</code> or <code>{{visitor_profile}}</code> in your prompt.</p>\n<p>For audience actions, you can also enable <strong>Add Current Visit</strong> to include current visit data within the visitor profile object.</p>\n<p><strong>Important</strong><br>\nIf the connector requires prompt instructions about the context data, include it as the first line of your prompt. For example:</p>\n<pre tabindex=\"0\"><code class=\"language-wrap\" data-lang=\"wrap\">You receive a JSON object describing a customer event:\r\n{{event_payload}}\n</code></pre><p>If the connector requires prompt instructions about the response format, include it at the end of the prompt. For example:</p>\n<pre tabindex=\"0\"><code class=\"language-wrap\" data-lang=\"wrap\">Return only a single JSON object on one line with the following structure: \r\n{\r\n  &#34;tealium_account&#34;: &#34;{{tealium_account}}&#34;,\r\n  &#34;tealium_profile&#34;: &#34;{{tealium_profile}}&#34;,\r\n  &#34;tealium_visitor_id&#34;: &#34;{{tealium_visitor_id}}&#34;,\r\n  &#34;tealium_event&#34;:  &#34;ai_response&#34;,\r\n  &#34;ai_review_sentiment&#34;: &#34;&lt;customer review sentiment&gt;&#34;\r\n}\n</code></pre><h4 id=\"question\">Question</h4>\n<p>Your prompt tells the model how to evaluate the data and asks to generate one or more specific values.</p>\n<p>For example, this prompt asks to generate a text value representing the sentiment of the customer&rsquo;s review:</p>\n<pre tabindex=\"0\"><code class=\"language-wrap\" data-lang=\"wrap\">Based on the provided product review event, classify the customer&#39;s sentiment as one of: &#34;dissatisfied&#34;, &#34;neutral&#34;, or &#34;satisfied&#34;.\n</code></pre><h3 id=\"response-event\">Response event</h3>\n<p>The connector parses the AI response and extracts a JSON object, which is sent back to Tealium Collect as an event.</p>\n<p>Example response event:</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;tealium_account&#34;</span>: <span style=\"color:#e6db74\">&#34;acme&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;tealium_profile&#34;</span>: <span style=\"color:#e6db74\">&#34;main&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;tealium_visitor_id&#34;</span>: <span style=\"color:#e6db74\">&#34;383...05d&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;tealium_event&#34;</span>: <span style=\"color:#e6db74\">&#34;ai_response&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;ai_review_sentiment&#34;</span>: <span style=\"color:#e6db74\">&#34;satisfied&#34;</span>\n</span></span><span style=\"display:flex;\"><span>}\n</span></span></code></pre></div><h3 id=\"examples\">Examples</h3>\n<h4 id=\"event-trigger\">Event trigger</h4>\n<p>In this example, the customer has just submitted a product review and the prompt asks the model to evaluate the sentiment.</p>\n<p><strong>Example prompt</strong>:</p>\n<pre tabindex=\"0\"><code class=\"language-wrap\" data-lang=\"wrap\">You receive a JSON object describing a customer&#39;s product review:\r\n{{event_payload}}\r\n\r\nBased on the provided product review event, classify the customer&#39;s sentiment as one of: &#34;dissatisfied&#34;, &#34;neutral&#34;, or &#34;satisfied&#34;.\r\n\r\nReturn only a single JSON object on one line with the following structure: \r\n{\r\n  &#34;tealium_account&#34;: &#34;{{tealium_account}}&#34;,\r\n  &#34;tealium_profile&#34;: &#34;{{tealium_profile}}&#34;,\r\n  &#34;tealium_visitor_id&#34;: &#34;{{tealium_visitor_id}}&#34;,\r\n  &#34;tealium_event&#34;:  &#34;ai_response&#34;,\r\n  &#34;ai_review_sentiment&#34;: &#34;&lt;customer review sentiment&gt;&#34;\r\n}\n</code></pre><p><strong>Example response event</strong>:</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;tealium_account&#34;</span>: <span style=\"color:#e6db74\">&#34;acme&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;tealium_profile&#34;</span>: <span style=\"color:#e6db74\">&#34;main&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;tealium_visitor_id&#34;</span>: <span style=\"color:#e6db74\">&#34;383...05d&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;tealium_event&#34;</span>: <span style=\"color:#e6db74\">&#34;ai_response&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;ai_review_sentiment&#34;</span>: <span style=\"color:#e6db74\">&#34;satisfied&#34;</span>\n</span></span><span style=\"display:flex;\"><span>}\n</span></span></code></pre></div><h4 id=\"audience-trigger\">Audience trigger</h4>\n<p>In this example, the customer joined an audience named &ldquo;Frequent Browser, No Purchases&rdquo; and the prompt asks the model to evaluate the customer&rsquo;s intent.</p>\n<p><strong>Example prompt</strong>:</p>\n<pre tabindex=\"0\"><code class=\"language-wrap\" data-lang=\"wrap\">You receive a JSON object describing a retail visitor:\r\n{{visitor_profile}}\r\n\r\nBased on the customer data provided, classify their likely shopping intent as: &#34;bargain hunting&#34;, &#34;product comparison&#34;, &#34;researching for later&#34;, or &#34;not interested&#34;. If data is missing, make a best effort guess.\r\n\r\nReturn only a single JSON object on one line with the following structure: \r\n{\r\n  &#34;tealium_account&#34;: &#34;{{tealium_account}}&#34;,\r\n  &#34;tealium_profile&#34;: &#34;{{tealium_profile}}&#34;,\r\n  &#34;tealium_visitor_id&#34;: &#34;{{tealium_visitor_id}}&#34;,\r\n  &#34;tealium_event&#34;:  &#34;ai_response&#34;,\r\n  &#34;ai_shopping_intent&#34;: &#34;&lt;customer shopping intent&gt;&#34;\r\n}\n</code></pre><p><strong>Example response event</strong>:</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;tealium_account&#34;</span>: <span style=\"color:#e6db74\">&#34;acme&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;tealium_profile&#34;</span>: <span style=\"color:#e6db74\">&#34;main&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;tealium_visitor_id&#34;</span>: <span style=\"color:#e6db74\">&#34;383...05d&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;tealium_event&#34;</span>: <span style=\"color:#e6db74\">&#34;ai_response&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;ai_shopping_intent&#34;</span>: <span style=\"color:#e6db74\">&#34;bargain hunting&#34;</span>\n</span></span><span style=\"display:flex;\"><span>}\n</span></span></code></pre></div><h3 id=\"activation\">Activation</h3>\n<p>If the model returns a valid JSON object, the connector forwards it to Tealium Collect as an inbound event. Enrichment rules then write the response values to visitor profile attributes. From there, audiences and downstream connectors activate based on the enriched profile.</p>\n<p class=\"tip\"><i class=\"fa fa-info-circle\"></i>Setting a value for <code>tealium_event</code> that&rsquo;s unique to the connector and naming the response attribute specific to the use case makes it easy to create event feeds or rules that match these events.</p>\n<p>Example rule for AI response event activation:</p>\n<div class=\"mv3 pv2 ph4 ba br2 b--light-gray\">\n  <div class=\"boolean-logic-container\">\n      <div class=\"condition-group\">\n        <span class=\"input\">tealium_event</span>\n        <span class=\"operator\">EQUALS</span>\n        <span class=\"filter\">ai_response</span>\n      </div>\n      <div class=\"fw8 mv2\">AND</div>\n      <div class=\"condition-group\">\n        <span class=\"input\">ai_review_sentiment</span>\n        <span class=\"operator\">IS POPULATED</span>\n        \n      </div>\n  </div>\n</div>\n<h3 id=\"test\">Test</h3>\n<p>Before activating an AI connector in production, enable <strong>Debug Mode</strong> in the connector mappings and test your setup with trace to validate your configuration and prompt behavior. Using debug mode helps catch errors and optimize prompts before incurring production costs or affecting live data.</p>\n<p>In debug mode, the connector executes the AI request but logs the result without sending the response event back to your account. Use the trace tool to inspect the full request and response, verify the generated output, and ensure that the trigger conditions and attribute mappings are working as expected.</p>\n<h3 id=\"supported-vendors\">Supported vendors</h3>\n<p>Configuration details such as authentication, model selection, prompt requirements, and action parameters are specific to each connector.</p>\n<p>The following AI connectors are available:</p>\n\n\n\n\n\n\n\n  \n  \n    \n  \n    \n  \n    \n      \n    \n  \n    \n      \n    \n  \n    \n  \n    \n      \n    \n  \n    \n      \n    \n  \n    \n      \n    \n  \n    \n      \n    \n  \n  \n\n\n\n\n\n<table>\n  <thead>\n    <tr>\n      <th>Connector</th>\n      <th>Description</th>\n    </tr>\n  </thead>\n  <tbody>\n    \n    <tr>\n      <td><a href=\"/server-side-connectors/amazon-bedrock-ai-connector/\">Amazon Bedrock AI</a></td>\n      <td>Set up the Amazon Bedrock AI connector to send Tealium event and visitor data to foundation models, managed prompts, or multi-step Bedrock workflows for real-time enrichment.</td>\n    </tr>\n    \n    <tr>\n      <td><a href=\"/server-side-connectors/anthropic-connector/\">Anthropic</a></td>\n      <td>Set up the Anthropic connector to send a prompt with Tealium event or visitor data and return model responses for real-time enrichment.</td>\n    </tr>\n    \n    <tr>\n      <td><a href=\"/server-side-connectors/google-vertex-ai-connector/\">Google Vertex AI</a></td>\n      <td>Set up the Google Vertex AI connector to invoke Vertex AI models with Tealium event data and return model responses for real-time visitor enrichment.</td>\n    </tr>\n    \n    <tr>\n      <td><a href=\"/server-side-connectors/google-vertex-commerce-connector/\">Google Vertex AI Search</a></td>\n      <td>Set up this connector to send Tealium event data to Google Vertex AI Search for personalized and intuitive shopping experiences.</td>\n    </tr>\n    \n    <tr>\n      <td><a href=\"/server-side-connectors/openai-connector/\">OpenAI</a></td>\n      <td>Set up the OpenAI connector to send a prompt with Tealium event or visitor data and return model responses for real-time enrichment.</td>\n    </tr>\n    \n    <tr>\n      <td><a href=\"/server-side-connectors/openai-events-connector/\">OpenAI Events</a></td>\n      <td>This article describes how to set up the OpenAI Events connector.</td>\n    </tr>\n    \n  </tbody>\n</table>\n\n\n<h2 id=\"functions-for-ai\">Functions for AI</h2>\n<h3 id=\"how-it-works-1\">How it works</h3>\n<p>Tealium functions provide a code-based approach for invoking your own model (IYOM). Instead of using a preconfigured connector, you write JavaScript to call any model endpoint directly from an event or visitor function. Use cases include traditional machine learning models returning numeric scores, LLMs hosted on platforms without a dedicated AI connector, and endpoints on data platforms such as Snowflake Cortex, Databricks Model Serving, or Amazon SageMaker.</p>\n<p>Tealium functions support both event functions (triggered after an event is processed) and visitor functions (triggered after a visitor profile updates), allowing you to score either immediate event context or accumulated visitor history.</p>\n<p>When a function fires, it follows these steps:</p>\n<ol>\n<li>Collect event attributes or visitor profile data.</li>\n<li>Build a request payload for your model endpoint.</li>\n<li>Call the endpoint using <code>fetch()</code>.</li>\n<li>Parse the response.</li>\n<li>Send the prediction to Tealium Collect using <code>track()</code>.</li>\n<li>Enrichments write the prediction values to the visitor profile.</li>\n</ol>\n<p>Because functions cannot directly modify visitor profiles, predictions must flow through Tealium Collect and be written to the profile through enrichments.</p>\n<p>Functions support both synchronous and asynchronous model invocation. For models that respond within 10 seconds, use a standard <code>await</code> pattern. For slower models, use a fire-and-forget pattern. The function sends the request and exits immediately. The model then POSTs the result to a callback URL when inference completes.</p>\n<p>For implementation details, see <a href=\"/guides/function-for-ai-activation/\">Create a function for AI activation</a>.</p>\n<h2 id=\"choosing-between-connectors-and-functions\">Choosing between connectors and functions</h2>\n<h3 id=\"use-an-ai-connector-when\">Use an AI connector when</h3>\n<ul>\n<li>You are invoking a large language model for prompt-based inference.</li>\n<li>Your use case maps to one of the supported AI providers.</li>\n<li>Your prompt uses a consistent template with event or visitor data as input.</li>\n<li>The model returns structured JSON that can be forwarded directly as a Tealium event.</li>\n<li>You want to configure the integration through the Tealium UI without writing code.</li>\n<li>Your use case consists of targeted, high-value events or audiences rather than high-volume, low-value events such as page views.</li>\n</ul>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>AI connectors are designed for use cases that return structured, predictable JSON output, such as classification labels, confidence values, or identifiers from a predefined list. They are not designed for long-form content or media generation. If your use case requires free-form output, align with your organization&rsquo;s AI governance processes before moving to production.</p>\n<h3 id=\"use-tealium-functions-when\">Use Tealium functions when</h3>\n<ul>\n<li>You need to invoke a traditional machine learning model that returns numeric scores or tabular predictions.</li>\n<li>Your model is hosted on a platform without a dedicated AI connector.</li>\n<li>Your payload requires custom logic, data transformation, or PII filtering before sending to the model.</li>\n<li>You need to handle asynchronous model responses or custom network configuration.</li>\n</ul>\n<p>When you must remove or tokenize PII before sending data to a model, use Tealium functions to apply custom filtering and send only the approved fields to the endpoint.</p>\n<h2 id=\"comparison-summary\">Comparison summary</h2>\n<table>\n<thead>\n<tr>\n<th>Consideration</th>\n<th>AI connectors</th>\n<th>Tealium functions</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Setup</td>\n<td>Configure through the UI</td>\n<td>Write JavaScript code</td>\n</tr>\n<tr>\n<td>Model types supported</td>\n<td>LLMs only</td>\n<td>Any ML or AI model, including traditional ML</td>\n</tr>\n<tr>\n<td>Supported providers</td>\n<td>See <a href=\"#supported-vendors\">Supported vendors</a></td>\n<td>Any HTTPS endpoint</td>\n</tr>\n<tr>\n<td>Prompt control</td>\n<td>Template-based with variable substitution</td>\n<td>Fully programmable</td>\n</tr>\n<tr>\n<td>Authentication</td>\n<td>Managed in connector settings</td>\n<td>Stored as authentication tokens in Tealium functions</td>\n</tr>\n<tr>\n<td>Payload structure</td>\n<td>Fixed based on event or visitor data</td>\n<td>Fully customizable</td>\n</tr>\n<tr>\n<td>PII filtering before model call</td>\n<td>Platform-level only (consent categories and restricted attributes). No custom pre-processing code inside the connector</td>\n<td>Fully customizable filtering and transformation in JavaScript before calling the model</td>\n</tr>\n<tr>\n<td>Response handling</td>\n<td>Automatic JSON parsing and event forwarding</td>\n<td>Custom parsing in code</td>\n</tr>\n<tr>\n<td>Asynchronous support</td>\n<td>Limited. The Bedrock AI Workflow action supports asynchronous responses through Lambda callbacks</td>\n<td>Supported through fire-and-forget pattern and model callbacks to Tealium Collect</td>\n</tr>\n</tbody>\n</table>\n<h2 id=\"common-use-cases\">Common use cases</h2>\n<p>The following table lists common AI use cases and the recommended integration approach for each.</p>\n<table>\n<thead>\n<tr>\n<th>Use case</th>\n<th>Description</th>\n<th>Recommended approach</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Sentiment analysis</td>\n<td>Classify customer feedback or review events as positive, neutral, or negative.</td>\n<td>AI connector</td>\n</tr>\n<tr>\n<td>Intent classification</td>\n<td>Identify a customer&rsquo;s likely intent based on browsing or purchase history.</td>\n<td>AI connector</td>\n</tr>\n<tr>\n<td>Next-best-action (playbook selection)</td>\n<td>Select from a finite set of approved actions or offers based on visitor context.</td>\n<td>AI connector</td>\n</tr>\n<tr>\n<td>Propensity scoring</td>\n<td>Predict the likelihood of a conversion, churn, or high-value action using a trained machine learning model.</td>\n<td>Tealium functions</td>\n</tr>\n<tr>\n<td>Next-best-action (score optimization)</td>\n<td>Score a set of candidate actions using a numeric model and select the highest-scoring one.</td>\n<td>Tealium functions</td>\n</tr>\n<tr>\n<td>Feature store lookup</td>\n<td>Retrieve pre-calculated scores or features from a data platform for activation.</td>\n<td>Tealium functions</td>\n</tr>\n<tr>\n<td>Custom endpoint inference</td>\n<td>Invoke a model hosted on a platform without a dedicated AI connector.</td>\n<td>Tealium functions</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/server-side-connectors/amazon-bedrock-ai-connector/",
            "title": "Amazon Bedrock AI Connector Setup Guide",
            "body": "<p class=\"tip\"><i class=\"fa fa-info-circle\"></i>For an overview of how AI connectors work and guidance on when to use an AI connector or Tealium functions, see <a href=\"/guides/ai-connectors-and-functions/\">AI connectors and Tealium functions</a>.</p>\n<h2 id=\"supported-models\">Supported models</h2>\n<p>The Amazon Bedrock AI connector supports a wide range of foundation models. For the current list of supported models, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html\">Amazon Bedrock: Supported foundation models in Amazon Bedrock</a>.</p>\n<p>Some Bedrock models require provisioned throughput and cannot be invoked using on-demand inference. If you encounter an on-demand throughput error, use a model that supports <code>ON_DEMAND</code> inference or provide a provisioned throughput or inference profile ARN in the configuration list.</p>\n<h2 id=\"create-iam-roles-and-permissions\">Create IAM roles and permissions</h2>\n<p>Tealium requires IAM roles and permissions in your AWS account to connect to Amazon Bedrock from your server-side connector. You have two options for authenticating the connection:</p>\n<ul>\n<li><a href=\"#access-key-and-secret-credentials\">Provide an Access Key and Access Secret</a>.</li>\n<li><a href=\"#sts-credentials\">Provide STS credentials</a>.</li>\n</ul>\n<h3 id=\"access-key-and-secret-credentials\">Access key and secret credentials</h3>\n<p>To create your AWS access key and secret:</p>\n<ol>\n<li>Log in to the AWS Management Console and go to the <strong>IAM</strong> (Identity and Access Management) service.</li>\n<li>Click <strong>Users</strong> and then click <strong>Add user</strong>.</li>\n<li>Enter a username. For example, <code>TealiumBedrockUser</code>.</li>\n<li>Attach policies to the user. For more information, see <a href=\"#attach-policies\">Attach policies</a>.</li>\n<li>Create the keys.\n<ul>\n<li>Go to the <strong>Security credentials</strong> tab and click <strong>Create Access Key</strong>.</li>\n<li>Copy the <strong>Access Key ID</strong> and <strong>Secret Access Key</strong>, and save them securely.</li>\n</ul>\n</li>\n</ol>\n<h3 id=\"sts-credentials\">STS credentials</h3>\n<p>To create your STS credentials:</p>\n<ol>\n<li>Log in to the AWS Management Console and go to the <strong>IAM</strong> (Identity and Access Management) service.</li>\n<li>Click <strong>Roles</strong>, and then click <strong>Create role</strong>.</li>\n<li>Under <strong>Trusted entity type</strong>, select the AWS account.</li>\n<li>Select <strong>Another AWS account</strong> and enter the Tealium account ID: <code>757913464184</code>.</li>\n<li>(Optional) Select the <strong>Require external ID</strong> checkbox and specify the external ID that you want to use. External IDs can be up to 256 characters long and can include alphanumeric characters (<code>A-Z</code>, <code>a-z</code>, <code>0-9</code>) and symbols, such as hyphens (<code>-</code>), underscores (<code>_</code>), and periods (<code>.</code>).</li>\n<li>Enter a name for the role. The role name must start with <code>TealiumBedrock</code>. For example: <code>TealiumBedrock-RoleName</code>.</li>\n<li>Attach policies to the role. For more information, see <a href=\"#attach-policies\">Attach policies</a>.</li>\n<li>Create a trust policy.\n<ul>\n<li>Go to the <strong>Trust relationships</strong> tab and click <strong>Edit trust relationship</strong>.</li>\n<li>Ensure that the trust policy allows the specific external ID to use the role you created and that the Tealium production account ID is <code>757913464184</code>.</li>\n<li>Set the <code>EXTERNAL_ID</code> value for the connection to Tealium. The ID can be up to 256 characters long and can include alphanumeric characters (<code>A-Z</code>, <code>a-z</code>, <code>0-9</code>) and symbols, such as hyphens (<code>-</code>), underscores (<code>_</code>), and periods (<code>.</code>).</li>\n</ul>\n</li>\n</ol>\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;Version&#34;</span>: <span style=\"color:#e6db74\">&#34;2012-10-17&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Statement&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>        {\n</span></span><span style=\"display:flex;\"><span>          <span style=\"color:#f92672\">&#34;Effect&#34;</span>: <span style=\"color:#e6db74\">&#34;Allow&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>          <span style=\"color:#f92672\">&#34;Principal&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#f92672\">&#34;AWS&#34;</span>: <span style=\"color:#e6db74\">&#34;arn:aws:iam::757913464184:root&#34;</span>\n</span></span><span style=\"display:flex;\"><span>          },\n</span></span><span style=\"display:flex;\"><span>          <span style=\"color:#f92672\">&#34;Action&#34;</span>: <span style=\"color:#e6db74\">&#34;sts:AssumeRole&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>          <span style=\"color:#f92672\">&#34;Condition&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#f92672\">&#34;StringEquals&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>              <span style=\"color:#f92672\">&#34;sts:ExternalId&#34;</span>: <span style=\"color:#e6db74\">&#34;EXTERNAL_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>        }\n</span></span><span style=\"display:flex;\"><span>      ]\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span></code></pre></div><h3 id=\"attach-policies\">Attach policies</h3>\n<p>In the AWS Management Console, enter the necessary policies for the connector actions you are using. The following policies are required for each connector action:</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>We recommend that you limit permissions to the specific ARNs of flows and Lambda functions you require.</p>\n\n<div class=\"code-tabs\">\n  <ul class=\"nav nav-tabs\"></ul>\n  <div class=\"tab-content\"><div class=\"tab-pane\" data-lang=\"Send Data to Bedrock AI Model\" title=\"Send Data to Bedrock AI Model\">\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;Version&#34;</span>: <span style=\"color:#e6db74\">&#34;2012-10-17&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;Statement&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>    {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Sid&#34;</span>: <span style=\"color:#e6db74\">&#34;ListModels&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Effect&#34;</span>: <span style=\"color:#e6db74\">&#34;Allow&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Action&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">&#34;bedrock:ListFoundationModels&#34;</span>\n</span></span><span style=\"display:flex;\"><span>      ],\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Resource&#34;</span>: <span style=\"color:#e6db74\">&#34;*&#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;Sid&#34;</span>: <span style=\"color:#e6db74\">&#34;InvokeModel&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Effect&#34;</span>: <span style=\"color:#e6db74\">&#34;Allow&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Action&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">&#34;bedrock:InvokeModel&#34;</span>\n</span></span><span style=\"display:flex;\"><span>      ],\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Resource&#34;</span>: <span style=\"color:#e6db74\">&#34;*&#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></code></pre></div>\n</div>\n<div class=\"tab-pane\" data-lang=\"Send Data to Bedrock AI Managed Prompt\" title=\"Send Data to Bedrock AI Managed Prompt\">\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;Version&#34;</span>: <span style=\"color:#e6db74\">&#34;2012-10-17&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;Statement&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>    {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Sid&#34;</span>: <span style=\"color:#e6db74\">&#34;RenderManagedPrompt&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Effect&#34;</span>: <span style=\"color:#e6db74\">&#34;Allow&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Action&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">&#34;bedrock:RenderPrompt&#34;</span>\n</span></span><span style=\"display:flex;\"><span>      ],\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Resource&#34;</span>: <span style=\"color:#e6db74\">&#34;*&#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></code></pre></div>\n</div>\n<div class=\"tab-pane\" data-lang=\"Send Data to Bedrock AI Workflow\" title=\"Send Data to Bedrock AI Workflow\">\n  <p>If you are using Lambda:</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;Version&#34;</span>: <span style=\"color:#e6db74\">&#34;2012-10-17&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;Statement&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>    {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Sid&#34;</span>: <span style=\"color:#e6db74\">&#34;BedrockFlowInvoke&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Effect&#34;</span>: <span style=\"color:#e6db74\">&#34;Allow&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Action&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">&#34;bedrock:InvokeFlow&#34;</span>\n</span></span><span style=\"display:flex;\"><span>      ],\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Resource&#34;</span>: <span style=\"color:#e6db74\">&#34;arn:aws:bedrock:&lt;REGION&gt;:&lt;ACCOUNT_ID&gt;:flow/&lt;flow_id&gt;/alias/&lt;alias_name&gt;&#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;Sid&#34;</span>: <span style=\"color:#e6db74\">&#34;LambdaInvokeFunction&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Effect&#34;</span>: <span style=\"color:#e6db74\">&#34;Allow&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Action&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">&#34;lambda:InvokeFunction&#34;</span>\n</span></span><span style=\"display:flex;\"><span>      ],\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Resource&#34;</span>: <span style=\"color:#e6db74\">&#34;arn:aws:lambda:&lt;REGION&gt;:&lt;ACCOUNT_ID&gt;:function:&lt;FUNCTION_NAME&gt;&#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></code></pre></div><p>If you are not using Lambda:</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;Version&#34;</span>: <span style=\"color:#e6db74\">&#34;2012-10-17&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;Statement&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>    {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Sid&#34;</span>: <span style=\"color:#e6db74\">&#34;BedrockFlowInvoke&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Effect&#34;</span>: <span style=\"color:#e6db74\">&#34;Allow&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Action&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#e6db74\">&#34;bedrock:InvokeFlow&#34;</span>\n</span></span><span style=\"display:flex;\"><span>      ],\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#f92672\">&#34;Resource&#34;</span>: <span style=\"color:#e6db74\">&#34;arn:aws:bedrock:&lt;REGION&gt;:&lt;ACCOUNT_ID&gt;:flow/&lt;flow_id&gt;/alias/&lt;alias_name&gt;&#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></code></pre></div>\n</div>\n</div>\n</div>\n\n<p>To enter and attach the policies:</p>\n<ol>\n<li>In the AWS console, go to <strong>IAM &gt; Policies</strong> and click <strong>Create policy</strong>.</li>\n<li>In the policy editor, select the <strong>JSON</strong> tab, paste the policy for your connector action, resolve any validation warnings, and click <strong>Next</strong>.</li>\n<li>Enter a policy name (for example, <code>TealiumCustomAccessPolicy</code>) and optional description, then click <strong>Create policy</strong>.</li>\n<li>Go to <strong>IAM &gt; Roles</strong> and select the role you want to modify.</li>\n<li>On the <strong>Permissions</strong> tab, click <strong>Add permissions &gt; Attach policies</strong>.</li>\n<li>Search for your custom policy, select it, and click <strong>Attach policies</strong>.</li>\n</ol>\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>Authentication Type</strong>: (Required) The type of authentication to use.\n<ul>\n<li><strong>Access Key</strong>\n<ul>\n<li><strong>Access Key</strong>: (Required) Provide your IAM user&rsquo;s access key. The associated IAM policy (for either IAM user or Assumed Role) must grant <code>bedrock:PutRecord</code> permission along with streams you want to send data to.</li>\n<li><strong>Secret Key</strong>: (Required) Provide your IAM user&rsquo;s secret key.</li>\n</ul>\n</li>\n<li><strong>STS</strong>\n<ul>\n<li><strong>STS - Assume Role: ARN</strong>: (Required) An Amazon Resource Name assigned to the role to assume. For more information, see: <a href=\"https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-api.html\">AWS: Switching to an IAM Role</a>.</li>\n<li><strong>STS - Assume Role: Session Name</strong>: (Required) A unique identifier of the assumed role session.</li>\n<li><strong>STS - Assume Role: External ID</strong>: (Optional) A unique identifier used by third parties when assuming roles in their customers&rsquo; accounts. For more information, see: <a href=\"https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html\">AWS: Access to AWS accounts owned by third parties</a>.</li>\n</ul>\n</li>\n</ul>\n</li>\n<li><strong>Region</strong>: (Required) Select a region.</li>\n</ul>\n<h2 id=\"prompt-information\">Prompt information</h2>\n<p>A Bedrock AI prompt, whether sent from Tealium, managed within Amazon Bedrock, or used in a flow, must be authored to return only valid JSON for Tealium to correctly process the response. Use the following guidelines:</p>\n<ul>\n<li>Use double curly braces to reference mapped parameters, for example: <code>{{tealium_account}}</code>, <code>{{tealium_profile}}</code>, <code>{{tealium_visitor_id}}</code>, <code>{{visitor_json}}</code>.</li>\n<li>Clearly instruct the model to return only valid JSON with no explanations, no markdown, no code fences, and no extra text before or after the JSON.</li>\n<li>Define the exact JSON structure you expect (field names, required keys, and value types) so the output can be parsed safely.</li>\n<li>Instruct the model to return Tealium fields explicitly (for example, <code>tealium_account</code>, <code>tealium_profile</code>, <code>tealium_visitor_id</code>, <code>tealium_event</code>).</li>\n<li>If you need to reference a specific attribute in the prompt, map that attribute to a vendor parameter. For example, map <code>Last product viewed</code> to <code>last_product_viewed</code> and reference it in the prompt as <code>{{last_product_viewed}}</code>.</li>\n<li>Avoid vague instructions. Write deterministic prompts so that repeated calls produce the same JSON schema.</li>\n<li>For best results, include a line such as: &ldquo;Return a single JSON object only, with no prose, no backticks, and no additional formatting.&rdquo;</li>\n</ul>\n<h3 id=\"prompt-example\">Prompt example</h3>\n<pre tabindex=\"0\"><code class=\"language-none\" data-lang=\"none\">You are an AI assistant that must return only valid JSON.\nDo not include explanations, markdown, code fences, or any text outside the JSON object.\n\nUsing the visitor data below, calculate a numeric score between 0 and 100 that represents\nthe visitor&#39;s likelihood to convert in this session.\n\nReturn a single JSON object only, with this exact structure:\n\n{\n  &#34;tealium_account&#34;: &#34;{{tealium_account}}&#34;,\n  &#34;tealium_profile&#34;: &#34;{{tealium_profile}}&#34;,\n  &#34;tealium_visitor_id&#34;: &#34;{{tealium_visitor_id}}&#34;,\n  &#34;tealium_event&#34;: &#34;bedrock_ai_insight&#34;,\n  &#34;visitor_score&#34;: &lt;integer between 0 and 100&gt;\n}\n\nVisitor data:\n{{visitor_json}}\n\nPay particular attention to the value of {{last_product_viewed}}.\n</code></pre><p>The response will resemble the following:</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;metrics&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;latencyMs&#34;</span>: <span style=\"color:#ae81ff\">1272</span>\n</span></span><span style=\"display:flex;\"><span>    },\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;output&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;message&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>            <span style=\"color:#f92672\">&#34;content&#34;</span>: [\n</span></span><span style=\"display:flex;\"><span>                {\n</span></span><span style=\"display:flex;\"><span>                    <span style=\"color:#f92672\">&#34;text&#34;</span>: <span style=\"color:#e6db74\">&#34;{\\&#34;tealium_account\\&#34;:\\&#34;your-account\\&#34;,\\&#34;tealium_profile\\&#34;:\\&#34;main\\&#34;,\\&#34;tealium_visitor_id\\&#34;:\\&#34;__your-account_main__5574_438850__\\&#34;,\\&#34;tealium_event\\&#34;:\\&#34;bedrock_ai_insight\\&#34;,\\&#34;visitor_score\\&#34;:85}&#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;role&#34;</span>: <span style=\"color:#e6db74\">&#34;assistant&#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;stopReason&#34;</span>: <span style=\"color:#e6db74\">&#34;end_turn&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;usage&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;inputTokens&#34;</span>: <span style=\"color:#ae81ff\">8811</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;outputTokens&#34;</span>: <span style=\"color:#ae81ff\">65</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;serverToolUsage&#34;</span>: {},\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;totalTokens&#34;</span>: <span style=\"color:#ae81ff\">8876</span>\n</span></span><span style=\"display:flex;\"><span>    }\n</span></span><span style=\"display:flex;\"><span>}\n</span></span></code></pre></div><p>The connector accepts the response and sends the JSON event object to the Tealium Collect API endpoint.</p>\n<h2 id=\"amazon-bedrock-flows\">Amazon Bedrock Flows</h2>\n<p>Amazon Bedrock Flows are multi-step AI orchestrations that combine prompts, knowledge bases, Lambda functions, conditional logic, and external data into a single reusable workflow. A flow defines how input data moves through prompts, enrichment steps, business logic, and final output to turn complex AI decisioning into a single API endpoint.</p>\n<p>To use the <strong>Send Data to Bedrock Flow</strong> action, create a flow in Amazon Bedrock that accepts input from Tealium, processes it through your AI steps, and sends the results back to Tealium through a Lambda function.</p>\n<p>The sections below describe the required and optional components of a flow.</p>\n<h3 id=\"step-1---define-the-flow-input\">Step 1 - Define the flow input</h3>\n<p>Every flow begins with an input node. This node represents the JSON document Tealium sends to the flow.</p>\n<p>Tealium sends your mapped attributes in the following format similar to the following example:</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:#e6db74\">&#34;document&#34;</span><span style=\"color:#960050;background-color:#1e0010\">:</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;tealium_account&#34;</span>: <span style=\"color:#e6db74\">&#34;services-example&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;tealium_profile&#34;</span>: <span style=\"color:#e6db74\">&#34;ai&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;tealium_visitor_id&#34;</span>: <span style=\"color:#e6db74\">&#34;1234567890abc&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;visitor_profile&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;lifetime_value&#34;</span>: <span style=\"color:#e6db74\">&#34;1200&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>        <span style=\"color:#f92672\">&#34;total_orders&#34;</span>: <span style=\"color:#ae81ff\">5</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>        }\n</span></span><span style=\"display:flex;\"><span>}\n</span></span></code></pre></div><p>Inside your flow, reference fields using <code>$.data.attribute_name</code>. Based on the previous example:</p>\n<table>\n<thead>\n<tr>\n<th>Tealium Attribute</th>\n<th>Bedrock Reference</th>\n<th>Example</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>tealium_account</code></td>\n<td><code>$.data.tealium_account</code> or <code>{{tealium_account}}</code></td>\n<td><code>services-example</code></td>\n</tr>\n<tr>\n<td><code>tealium_profile</code></td>\n<td><code>$.data.tealium_profile</code> or <code>{{tealium_profile}}</code></td>\n<td><code>ai</code></td>\n</tr>\n<tr>\n<td><code>tealium_visitor_id</code></td>\n<td><code>$.data.tealium_visitor_id</code> or <code>{{tealium_visitor_id}}</code></td>\n<td><code>1234567890abc</code></td>\n</tr>\n<tr>\n<td><code>visitor_profile</code></td>\n<td><code>$.data.visitor_profile</code></td>\n<td><code>&quot;visitor_profile&quot;: {&quot;lifetime_value&quot;: &quot;1200&quot;,&quot;total_orders&quot;: 5,...}</code></td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"step-2---map-data-into-a-prompt-node-required\">Step 2 - Map data into a prompt node (Required)</h3>\n<p>Next, add a prompt node to generate AI output (such as a score, recommendation, or decision).</p>\n<p>Inside the prompt node:</p>\n<ol>\n<li>Set your prompt text.</li>\n<li>Insert variables using the <code>{{fieldname}}</code> format. For example, <code>{{tealium_account}}</code>.</li>\n<li>Choose a Bedrock model.</li>\n<li>Return valid JSON as the output of the prompt.</li>\n</ol>\n<p>For an example, see the <a href=\"#prompt-example\">Prompt example</a> section above.</p>\n<h3 id=\"step-3---optional-add-knowledge-base-retrieval\">Step 3 - (Optional) Add knowledge base retrieval</h3>\n<p>Amazon Bedrock Knowledge Bases let you connect your AI workflows to external data sources, such as Amazon S3, Amazon Redshift, or Amazon OpenSearch Service. A knowledge base stores and indexes your documents, making them available for retrieval and grounding during prompt execution. When you add a knowledge base node to your flow, the model can use relevant information from your data to generate more accurate and context-aware responses. This step is optional, but it is valuable for personalization, recommendations, or contextual decisioning.</p>\n<p>After you connect the knowledge base, you can pass knowledge base results into your prompt using fields like <code>{{$.kbResults}}</code>.</p>\n<p>For more information on knowledge bases, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base.html\">Amazon Bedrock: Retrieve data and generate AI responses with Amazon Bedrock Knowledge Bases</a>.</p>\n<p>For more information on creating a knowledge base, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-create.html\">Amazon Bedrock: Create a knowledge base by connecting to a data source in Amazon Bedrock Knowledge Bases</a>.</p>\n<h3 id=\"step-4---add-a-lambda-node-to-send-results-back-to-tealium-required-for-tealium-integration\">Step 4 - Add a Lambda node to send results back to Tealium (Required for Tealium Integration)</h3>\n<p>After your prompt produces structured JSON, you must send that result back into Tealium for profile enrichment.</p>\n<p>Add a Lambda node that:</p>\n<ul>\n<li>Receives the prompt output (<code>$.data</code> from your prompt node).</li>\n<li>Parses the JSON.</li>\n<li>Posts it to Tealium Collect: <code>POST https://collect.tealiumiq.com/event</code>.</li>\n<li>Includes the following:\n<ul>\n<li><code>tealium_account</code></li>\n<li><code>tealium_profile</code></li>\n<li><code>tealium_visitor_id</code></li>\n<li><code>tealium_event</code> (user-defined)</li>\n<li>Your AI output fields (for example, <code>visitor_score</code>)</li>\n</ul>\n</li>\n</ul>\n<p>Use <a href=\"#lambda-example\">our provided Lambda example</a> or build your own.</p>\n<h3 id=\"step-5---add-a-flow-output-node\">Step 5 - Add a flow output node</h3>\n<p>Although Tealium does not process the flow’s API response, an output node is required to complete the flow.</p>\n<p>Connecting your Lambda output to the <code>FlowOutputNode</code> doesn’t affect Tealium processing, but helps you verify that the flow works with the following tools:</p>\n<ul>\n<li>Debug in the Bedrock console.</li>\n<li>View errors from the Lambda function.</li>\n<li>Inspect final JSON results for validation.</li>\n<li>View output in Tealium using Trace.</li>\n</ul>\n<h4 id=\"lambda-example\">Lambda example</h4>\n<p>The following is a Lambda example for accepting prompt output, parsing the JSON, and sending that data to the Tealium Collect endpoint for enrichment and activation in Tealium. It includes fallbacks to account for various data structures. Rewrite yours as needed.</p>\n<p>The account and profile must be configured to accept server-side events with the specified data source.</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>This example requires Node.js version 18.x or later as the runtime environment.</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 Lambda 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\">const</span> <span style=\"color:#a6e22e\">COLLECT_URL</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">process</span>.<span style=\"color:#a6e22e\">env</span>.<span style=\"color:#a6e22e\">COLLECT_URL</span> <span style=\"color:#f92672\">||</span> <span style=\"color:#e6db74\">&#34;https://collect.tealiumiq.com/event&#34;</span>;\n</span></span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">function</span> <span style=\"color:#a6e22e\">extractInputByName</span>(<span style=\"color:#a6e22e\">event</span>, <span style=\"color:#a6e22e\">name</span>) {\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">arr</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">node</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">inputs</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (Array.<span style=\"color:#a6e22e\">isArray</span>(<span style=\"color:#a6e22e\">arr</span>)) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">hit</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">arr</span>.<span style=\"color:#a6e22e\">find</span>(<span style=\"color:#a6e22e\">i</span> =&gt; <span style=\"color:#a6e22e\">i</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">name</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#a6e22e\">name</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">hit</span> <span style=\"color:#f92672\">&amp;&amp;</span> <span style=\"color:#66d9ef\">typeof</span> <span style=\"color:#a6e22e\">hit</span>.<span style=\"color:#a6e22e\">value</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#34;string&#34;</span>) <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">hit</span>.<span style=\"color:#a6e22e\">value</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#a6e22e\">hit</span> <span style=\"color:#f92672\">&amp;&amp;</span> <span style=\"color:#66d9ef\">typeof</span> <span style=\"color:#a6e22e\">hit</span>.<span style=\"color:#a6e22e\">value</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#34;object&#34;</span>) <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>(<span style=\"color:#a6e22e\">hit</span>.<span style=\"color:#a6e22e\">value</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:#66d9ef\">undefined</span>;\n</span></span><span style=\"display:flex;\"><span>}\n</span></span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">function</span> <span style=\"color:#a6e22e\">extractJsonStringFromEvent</span>(<span style=\"color:#a6e22e\">event</span>) {\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">fromStandardPin</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">extractInputByName</span>(<span style=\"color:#a6e22e\">event</span>, <span style=\"color:#e6db74\">&#34;codeHookInput&#34;</span>);\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#66d9ef\">typeof</span> <span style=\"color:#a6e22e\">fromStandardPin</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#34;string&#34;</span>) <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">fromStandardPin</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">anyString</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">node</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">inputs</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">find</span><span style=\"color:#f92672\">?</span>.(<span style=\"color:#a6e22e\">i</span> =&gt; <span style=\"color:#66d9ef\">typeof</span> <span style=\"color:#a6e22e\">i</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">value</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#34;string&#34;</span>)<span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">value</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#66d9ef\">typeof</span> <span style=\"color:#a6e22e\">anyString</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#34;string&#34;</span>) <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">anyString</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#66d9ef\">typeof</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">codeHookInput</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#34;string&#34;</span>) <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">event</span>.<span style=\"color:#a6e22e\">codeHookInput</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#66d9ef\">typeof</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.document <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#34;string&#34;</span>) <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">event</span>.document;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">doc</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">event</span><span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">fields</span><span style=\"color:#f92672\">?</span>.[<span style=\"color:#ae81ff\">0</span>]<span style=\"color:#f92672\">?</span>.<span style=\"color:#a6e22e\">content</span><span style=\"color:#f92672\">?</span>.document;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#66d9ef\">typeof</span> <span style=\"color:#a6e22e\">doc</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#34;string&#34;</span>) <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">doc</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#66d9ef\">typeof</span> <span style=\"color:#a6e22e\">event</span> <span style=\"color:#f92672\">===</span> <span style=\"color:#e6db74\">&#34;string&#34;</span>) <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">event</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\">&#34;Could not find JSON string in event&#34;</span>);\n</span></span><span style=\"display:flex;\"><span>}\n</span></span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">export</span> <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">handler</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">async</span> (<span style=\"color:#a6e22e\">event</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">try</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">jsonStr</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">extractJsonStringFromEvent</span>(<span style=\"color:#a6e22e\">event</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">obj</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">parse</span>(<span style=\"color:#a6e22e\">jsonStr</span>);  <span style=\"color:#75715e\">// Fixed: store parsed result\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">required</span> <span style=\"color:#f92672\">=</span> [<span style=\"color:#e6db74\">&#34;tealium_account&#34;</span>, <span style=\"color:#e6db74\">&#34;tealium_profile&#34;</span>, <span style=\"color:#e6db74\">&#34;tealium_visitor_id&#34;</span>];\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">for</span> (<span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">key</span> <span style=\"color:#66d9ef\">of</span> <span style=\"color:#a6e22e\">required</span>) {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span>Object.<span style=\"color:#a6e22e\">prototype</span>.<span style=\"color:#a6e22e\">hasOwnProperty</span>.<span style=\"color:#a6e22e\">call</span>(<span style=\"color:#a6e22e\">obj</span>, <span style=\"color:#a6e22e\">key</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\">`Missing required field &#39;</span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">key</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">&#39; in model output`</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\">r</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">fetch</span>(<span style=\"color:#a6e22e\">COLLECT_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> { <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:#a6e22e\">body</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">jsonStr</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\">r</span>.<span style=\"color:#a6e22e\">ok</span>) {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">txt</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">r</span>.<span style=\"color:#a6e22e\">text</span>().<span style=\"color:#66d9ef\">catch</span>(() =&gt; <span style=\"color:#e6db74\">&#34;&#34;</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\">`Collect failed </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">r</span>.<span style=\"color:#a6e22e\">status</span><span style=\"color:#e6db74\">}</span><span style=\"color:#e6db74\">: </span><span style=\"color:#e6db74\">${</span><span style=\"color:#a6e22e\">txt</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\">jsonStr</span>;\n</span></span><span style=\"display:flex;\"><span>  } <span style=\"color:#66d9ef\">catch</span> (<span style=\"color:#a6e22e\">err</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;Shim error:&#34;</span>, <span style=\"color:#a6e22e\">err</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>({ <span style=\"color:#a6e22e\">ok</span><span style=\"color:#f92672\">:</span> <span style=\"color:#66d9ef\">false</span>, <span style=\"color:#a6e22e\">error</span><span style=\"color:#f92672\">:</span> String(<span style=\"color:#a6e22e\">err</span>.<span style=\"color:#a6e22e\">message</span> <span style=\"color:#f92672\">||</span> <span style=\"color:#a6e22e\">err</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<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 Prompt to Bedrock AI Model</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✓</td>\n</tr>\n<tr>\n<td>Send Data to Bedrock AI Managed Prompt</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✓</td>\n</tr>\n<tr>\n<td>Send Data to Bedrock AI Workflow</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✓</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"send-prompt-to-bedrock-ai-model\">Send Prompt to Bedrock AI Model</h3>\n<p>Use <strong>Send Prompt to Bedrock AI Model</strong> when you need a simple, single-model call that returns a response synchronously through the connector.</p>\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>Model ID or Inference Profile ARN</td>\n<td>Select an Amazon Bedrock model to use on-demand inference, or manually enter a Provisioned Throughput model ARN or inference profile ARN.<br>Only models that support on-demand inference and text input/output are shown.<br>If the model you want does not appear, verify that the model is enabled in your AWS account and region and that it supports on-demand inference.<br><br><br>If using Provisioned Throughput, enter the full model ARN (for example: <code>arn:aws:bedrock:region:account-id:provisioned-model/...</code>).<br>Inference profile ARNs may also be used if configured in your AWS account.<br>Model availability and supported inference types are determined by your AWS account permissions and region configuration.</td>\n</tr>\n<tr>\n<td>Prompt Parameters</td>\n<td>Map parameters to a placeholder to replace in the prompt. By default, the connector has access to <code>{{tealium_account}}</code>, <code>{{tealium_profile}}</code>, and <code>{{tealium_visitor_id}}</code>. These can be overwritten with mapping.</td>\n</tr>\n<tr>\n<td>Add Visitor Profile</td>\n<td>(Only audience actions) Whether to allow the visitor profile for use in the prompt template as the variable <code>{{visitor_profile}}</code>.</td>\n</tr>\n<tr>\n<td>Add Current Visit</td>\n<td>(Only audience actions) Whether to include current visit data in the <code>{{visitor_profile}}</code> object.</td>\n</tr>\n<tr>\n<td>Add Event Payload</td>\n<td>(Only event actions) Whether to allow the event payload for use in the prompt template as the variable <code>{{event_payload}}</code>.</td>\n</tr>\n<tr>\n<td>Prompt</td>\n<td><ul><li>Use double curly braces to reference mapped parameters, for example: <code>{{tealium_account}}</code>, <code>{{visitor_id}}</code>, <code>{{event_value}}</code>.</li><li>Use <code>{{visitor_profile}}</code> to include the visitor profile in the prompt.<br>Clearly instruct the model to return only valid JSON, with no explanations, markdown, code fences, or extra text.</li><li>Define the exact JSON structure expected (for example, field names, required keys, value formats).</li><li>If Tealium fields must be included, specify them explicitly in the prompt.<br>Avoid ambiguous phrasing. Write deterministic prompts.</li><li>Include direct instructions such as: &ldquo;Return a single JSON object only, with no prose, no backticks, and no extra formatting.&quot;</li></ul></td>\n</tr>\n<tr>\n<td>Debug Mode</td>\n<td>When debug mode is enabled, the connector accepts the raw Bedrock response without sending it to Tealium Collect. Use Trace to validate the response format before enabling full processing.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"inference-parameters\">Inference Parameters</h4>\n<p>For more information, see <a href=\"https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_InferenceConfiguration.html\">Amazon Bedrock API Reference: InferenceConfiguration</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><code>maxTokens</code></td>\n<td>Maximum number of tokens the model may generate in its response. Lower values produce shorter outputs and help reduce latency, cost, and throttling risk.</td>\n</tr>\n<tr>\n<td><code>temperature</code></td>\n<td>Controls randomness in the output. Lower values (such as <code>0.2</code>) make responses more deterministic and higher values (such as <code>0.8</code>) produce more creative and varied results.</td>\n</tr>\n<tr>\n<td><code>topP</code></td>\n<td>Nucleus sampling parameter that limits token selection to the smallest set whose cumulative probability exceeds this value. Lower values make output more focused; higher values allow more diversity.</td>\n</tr>\n<tr>\n<td><code>stopSequences</code></td>\n<td>One or more strings that cause the model to stop generating when encountered. Useful for truncating responses or enforcing structured output boundaries.</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"send-data-to-bedrock-ai-managed-prompt\">Send Data to Bedrock AI Managed Prompt</h3>\n<p>Use <strong>Send Data to Bedrock AI Managed Prompt</strong> when you want a reusable, versioned call to a prompt that returns a response synchronously through the connector.</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>Prompt ARN</td>\n<td>(Required) Provide the ARN of a Bedrock Prompt Management template. The prompt ARN can be found in the <strong>Overview</strong> section of the prompt details in Bedrock.</td>\n</tr>\n<tr>\n<td>Prompt Data</td>\n<td><ul><li>Tealium passes mapped attributes into the prompt when invoking it.</li><li>The connector includes the variables <code>tealium_account</code>, <code>tealium_profile</code>, and <code>tealium_visitor_id</code> in the prompt. These can be overwritten with mapping.</li><li>Write the prompt to clearly instruct the model to return only valid JSON, with no explanations, no markdown, no code fences, and no additional text before or after the JSON.</li><li>You must author the prompt to include instructions for the model to return <code>tealium_account</code>, <code>tealium_profile</code>, and <code>tealium_visitor_id</code> in the JSON.</li><li>Avoid ambiguous phrasing. Write deterministic prompts so the output can be parsed reliably.</li><li>For best results, include a direct instruction such as: &ldquo;Return a single JSON object only, with no prose, no backticks, and no extra formatting.&quot;</li></ul></td>\n</tr>\n<tr>\n<td>Add Visitor Profile</td>\n<td>(Only audience actions) Whether to allow the visitor profile for use in the prompt template as the variable <code>{{visitor_profile}}</code>.</td>\n</tr>\n<tr>\n<td>Add Current Visit</td>\n<td>(Only audience actions) Whether to include current visit data in the <code>{{visitor_profile}}</code> object.</td>\n</tr>\n<tr>\n<td>Add Event Payload</td>\n<td>(Only event actions) Whether to allow the event payload for use in the prompt template as the variable <code>{{event_payload}}</code>.</td>\n</tr>\n<tr>\n<td>Debug Mode</td>\n<td>When debug mode is enabled, the connector accepts the raw Bedrock response without sending it to Tealium Collect. Use Trace to validate the response format before enabling full processing.</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"send-data-to-bedrock-ai-workflow\">Send Data to Bedrock AI Workflow</h3>\n<p>Use <strong>Send Data to Bedrock AI Workflow</strong> when you need multi-step orchestration or knowledge base retrieval that runs asynchronously through Lambda.</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>Bedrock Flow Alias ARN</td>\n<td>(Required) Enter the ARN of the Bedrock Flow Alias you want this action to invoke. We recommend creating an alias such as <code>live</code> and using that ARN here.</td>\n</tr>\n<tr>\n<td>Flow Data</td>\n<td><ul><li>Change which Flow Version that alias points to in AWS without updating this connector.</li><li>The connector sends your mapped fields to the Flow as a JSON object named document.</li><li>Inside your Flow, reference these fields using <code>$.data.&lt;fieldName&gt;</code> in Prompt, Lambda, or other nodes.</li><li>By default, <code>tealium_account</code>, <code>tealium_profile</code>, and <code>tealium_visitor_id</code> are included automatically, and can be overwritten through field mappings if needed.</li><li>Your flow must include a <code>FlowOutputNode</code>, but Tealium does not use its output.</li><li>Use Lambda to send data back into Tealium through the Collect endpoint.</li><li>We recommend wiring the Lambda output into the <code>FlowOutputNode</code> to see success/error information when testing the flow in the Bedrock console.</li></ul></td>\n</tr>\n<tr>\n<td>Add Visitor Profile</td>\n<td>(Only audience actions) Whether to include the full visitor profile in the Flow input as a <code>visitor_profile</code> JSON object.</td>\n</tr>\n<tr>\n<td>Add Current Visit</td>\n<td>(Only audience actions) Whether to include the current visit data in the <code>visitor_profile</code> JSON object.</td>\n</tr>\n<tr>\n<td>Add Event Payload</td>\n<td>(Only event actions) Whether to include the event payload in the Flow input as the <code>event_payload</code> JSON object.</td>\n</tr>\n</tbody>\n</table>\n<h2 id=\"common-errors-and-troubleshooting\">Common errors and troubleshooting</h2>\n<p>The following are common error codes and resolutions:</p>\n<h3 id=\"common-aws-error-codes\">Common AWS error codes:</h3>\n<ul>\n<li>\n<p><strong><code>AccessDeniedException</code> or <code>NotAuthorized</code></strong><br>\nYour IAM user or role doesn’t have the required permissions (for example, <code>bedrock:InvokeModel</code>, <code>bedrock:RenderPrompt</code>, <code>bedrock:InvokeFlow</code>, <code>bedrock:ListFoundationModels</code>).<br>\nTo solve this, update the IAM policy attached to the role or access keys to include the needed Bedrock actions on the correct resources.</p>\n</li>\n<li>\n<p><strong><code>InvalidClientTokenId</code>, <code>UnrecognizedClientException</code>, or <code>ExpiredTokenException</code></strong><br>\nThe configured access keys or STS session are invalid or expired.<br>\nTo solve this, rotate and re‑enter credentials in the connector, or verify the STS role and external ID are correct and not expired.</p>\n</li>\n<li>\n<p><strong><code>OptInRequired</code> or <code>FTUFormNotFilled</code></strong><br>\nThe AWS account is not fully enabled for Bedrock or for a specific model (for example, Anthropic).<br>\nTo solve this, complete the required Bedrock enablement steps and any model‑specific forms or Marketplace subscriptions in the AWS console.</p>\n</li>\n</ul>\n<p>If you see any of these errors, resolve the IAM or account setup in AWS first. Retrying the connector action alone will not succeed until permissions are corrected.</p>\n<h3 id=\"common-errors-from-bedrock-api-calls\">Common errors from Bedrock API calls</h3>\n<p>The following errors mean the request reached Bedrock, but the service or model could not complete it successfully.</p>\n<ul>\n<li>\n<p><strong><code>ValidationException</code> or <code>ValidationError</code></strong><br>\nThe request body or parameters are invalid for the target model or API (for example, wrong model ID, unsupported parameters, input too large).<br>\nTo solve this, verify the model ID / prompt ARN / flow ARN, ensure the request body matches the model’s expected schema, and reduce prompt size or max tokens if needed.</p>\n</li>\n<li>\n<p><strong><code>ResourceNotFound</code> or <code>ResourceNotFoundException</code></strong><br>\nThe specified model, prompt version, or Flow alias ARN does not exist or is not available in that region.<br>\nTo solve this, double‑check ARNs and region in the connector configuration against the values shown in the Bedrock console.</p>\n</li>\n<li>\n<p><strong><code>ThrottlingException</code> or <code>ServiceQuotaExceededException</code></strong><br>\nYour calls exceed Bedrock quotas (for example, TPS or token limits).<br>\nTo solve this, reduce call frequency or request a quota increase in AWS.</p>\n</li>\n<li>\n<p><strong><code>ServiceUnavailable</code>, <code>InternalFailure</code>, or <code>InternalServerException</code></strong><br>\nTemporary or internal errors within Bedrock.<br>\nTo solve this, if errors persist, check the AWS Service Health Dashboard or open an AWS Support case.</p>\n</li>\n<li>\n<p><strong><code>ModelErrorException</code>, <code>ModelNotReadyException</code>, or <code>ModelTimeoutException</code></strong> (prompt or managed prompt flows)<br>\nThe model failed, is still warming up, or took too long to respond.<br>\nTo solve this, wait and retry, simplify the prompt or reduce token usage, and confirm the model or provisioned throughput is fully active.</p>\n</li>\n</ul>\n<p>For all of these errors, Tealium displays the original AWS error message from Bedrock so you can match it against AWS documentation when you are troubleshooting.</p>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/server-side-connectors/anthropic-connector/",
            "title": "Anthropic Connector Setup Guide",
            "body": "<p class=\"tip\"><i class=\"fa fa-info-circle\"></i>For an overview of how AI connectors work and how to structure your prompts, see our guide to <a href=\"/guides/ai-connectors-and-functions/\">AI connectors</a>.</p>\n<h2 id=\"how-it-works\">How it works</h2>\n<p>This connector invokes an Anthropic model with your custom prompt and mapped Tealium data, then sends the response as a JSON event back to Tealium Collect for real-time enrichment.</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>The connector should be used for targeted, high-value interactions rather than high-volume events. Excessive usage may result in rate limits or increased API costs in your vendor account and add to your inbound Tealium event volume.</p>\n<h2 id=\"usage-and-cost-considerations\">Usage and cost considerations</h2>\n<p>Before activating this connector, review your account limits, usage tier, and pricing model. This connector can generate a high volume of requests depending on your event and audience triggers, which may result in unexpected usage or overage costs.</p>\n<p>For more information, see <a href=\"https://platform.claude.com/docs/en/api/rate-limits\">Claude API Docs: Rate limits</a>.</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: Anthropic API</li>\n<li>API Version: v1</li>\n<li>API Endpoint: <code>https://api.anthropic.com/v1</code></li>\n<li>Documentation: <a href=\"https://platform.claude.com/docs/en/home\">Anthropic API</a></li>\n</ul>\n<h2 id=\"configuration\">Configuration</h2>\n<p>Navigate 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>Anthropic API Key</strong>: Your Anthropic API key to authenticate requests from this connector to the Anthropic API. Create and manage API keys in your Anthropic account settings.</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 Prompt to Anthropic</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✓</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"send-prompt-to-anthropic\">Send Prompt to Anthropic</h3>\n<p class=\"tip\"><i class=\"fa fa-info-circle\"></i>For an overview of how AI connectors work and how to structure your prompts, see our guide to <a href=\"/guides/ai-connectors-and-functions/\">AI connectors</a>.</p>\n<h4 id=\"mappings\">Mappings</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>Model</td>\n<td>Select the Anthropic model to use for this prompt. Choose a model that aligns with your performance and cost requirements.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"tealium-context\">Tealium Context</h4>\n<p>The connector automatically includes important Tealium attributes when invoking the AI model and when returning the structured response.</p>\n<p>The following attributes are automatically added to the AI request and included in the structured output JSON: <code>tealium_account</code>, <code>tealium_profile</code>, <code>tealium_visitor_id</code>.</p>\n<p>These values are taken from the current event and do not need to be referenced in the prompt. You may override these values using mappings.</p>\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><code>tealium_event</code></td>\n<td>(Required) Enter the <code>tealium_event</code> value to include in the AI response returned to Tealium.</td>\n</tr>\n<tr>\n<td><code>tealium_datasource</code></td>\n<td>(Optional) The data source key associated with the response events from this connector.</td>\n</tr>\n<tr>\n<td>Prompt Parameters</td>\n<td>Map Tealium attributes to placeholder names used in your prompt template. For example, map <code>Lifetime Value</code> to <code>lifetime_val</code>, then reference <code>{{lifetime_val}}</code> in the prompt template.</td>\n</tr>\n<tr>\n<td>Include Event Payload</td>\n<td>(Available for event actions) Check this box to include the event payload for use in the prompt template as variable <code>{{event_payload}}</code>.</td>\n</tr>\n<tr>\n<td>Include Visitor Profile</td>\n<td>(Available for audience actions) When enabled, the full visitor profile is made available to the prompt as <code>{{visitor_profile}}</code>.</td>\n</tr>\n<tr>\n<td>Include Current Visit</td>\n<td>(Available for audience actions) When enabled, current visit attributes are added to the <code>{{visitor_profile}}</code> object (keyed by attribute name).</td>\n</tr>\n<tr>\n<td>Prompt</td>\n<td>Enter the prompt to send to the selected Anthropic model. Use the guidelines below to ensure consistent and machine-readable output:<br>Use double curly braces for mapped parameters, for example: <code>{{product_id}}</code>, <code>{{event_value}}</code>.<br>For audience connector actions, reference <code>{{visitor_profile}}</code> after enabling <code>Include visitor profile</code>.<br>For event connector actions, reference <code>{{event_payload}}</code> after enabling <code>Include current event payload</code>.<br>Do not include JSON formatting instructions (for example, <code>Return only JSON</code>). The connector enforces the JSON structure automatically.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"advanced-model-settings\">Advanced Model Settings</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><code>temperature</code></td>\n<td>Controls randomness and creativity (lower = more deterministic).</td>\n</tr>\n<tr>\n<td><code>max_tokens</code></td>\n<td>Maximum number of tokens the model can generate. If a value is not provided, the connector sets the default to 512.</td>\n</tr>\n<tr>\n<td><code>top_p</code></td>\n<td>Controls diversity by sampling only from the top-p probability mass.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"structured-output-json-schema\">Structured Output (JSON Schema)</h4>\n<p>Define the attributes to include in the AI response. These mappings determine the schema sent to Anthropic using <code>output_config</code> to ensure the response JSON matches the schema.</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>Do not add JSON formatting instructions to your prompt. The schema derived from these mappings enforces the structure automatically.</p>\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>Attribute name</td>\n<td>The attribute name to include in the AI response event. You must create a matching event attribute for enrichment.</td>\n</tr>\n<tr>\n<td>Required/Optional</td>\n<td>Determines if the attribute is required or optional in the response event.</td>\n</tr>\n<tr>\n<td>Data type</td>\n<td>The data type of the field (string, number, integer, or boolean).</td>\n</tr>\n<tr>\n<td>Debug Mode</td>\n<td>When enabled, the connector does not send responses to Tealium Collect. Use Trace to inspect the raw Anthropic response and validate that it is valid JSON before enabling full processing.</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/guides/chatgpt-apps/",
            "title": "Tealium + ChatGPT Apps",
            "body": "<h2 id=\"introduction\">Introduction</h2>\n<p>Tealium offers a data foundation for app-like experiences in browsers, widgets, and custom ChatGPT interfaces. It supports consistent data collection and visitor identity management across platforms.</p>\n<p>This solution for ChatGPT uses an MCP-friendly design to achieve the following:</p>\n<ul>\n<li>Track key interactions (product views, button clicks, purchases).</li>\n<li>Unify identity across client, server, and ChatGPT contexts.</li>\n<li>Stream events in real time using Tealium Collect.</li>\n<li>Personalize experiences using Tealium Moments API and Tealium AudienceStream.</li>\n</ul>\n<h2 id=\"option-1-client-side-tracking\">Option 1: Client-side tracking</h2>\n<p>This approach uses the standard <a href=\"/platforms/javascript/\">Universal Tag (<code>utag.js</code>)</a> installation from a dedicated profile in Tealium iQ. The only difference is that it does not rely on the anonymous ID generated by <code>utag.js</code>, so it generates and persists its own ID using utility functions.</p>\n<p><strong>Benefits:</strong></p>\n<ul>\n<li>Full access to the Tealium iQ Tag Management tag vendor marketplace.</li>\n<li>Built-in support for consent.</li>\n<li>Supports A/B testing and personalization triggers.</li>\n</ul>\n<p>The following sample code demonstrates the following:</p>\n<ul>\n<li>Load <code>utag.js</code>, just like you do on a web site.</li>\n<li>Generate and persist an anonymous visitor ID.</li>\n<li>Track the initial loading of the ChatGPT app.</li>\n<li>Track related user actions with custom methods.</li>\n</ul>\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-html\" data-lang=\"html\"><span style=\"display:flex;\"><span>&lt;<span style=\"color:#f92672\">script</span>&gt;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">// Load Tealium iQ\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  (<span style=\"color:#66d9ef\">function</span>(<span style=\"color:#a6e22e\">a</span>,<span style=\"color:#a6e22e\">b</span>,<span style=\"color:#a6e22e\">c</span>,<span style=\"color:#a6e22e\">d</span>){\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">a</span><span style=\"color:#f92672\">=</span><span style=\"color:#e6db74\">&#39;https://tags.tiqcdn.com/utag/[ACCOUNT]/[PROFILE]/[ENVIRONMENT]/utag.js&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">b</span><span style=\"color:#f92672\">=</span>document;<span style=\"color:#a6e22e\">c</span><span style=\"color:#f92672\">=</span><span style=\"color:#e6db74\">&#39;script&#39;</span>;<span style=\"color:#a6e22e\">d</span><span style=\"color:#f92672\">=</span><span style=\"color:#a6e22e\">b</span>.<span style=\"color:#a6e22e\">createElement</span>(<span style=\"color:#a6e22e\">c</span>);<span style=\"color:#a6e22e\">d</span>.<span style=\"color:#a6e22e\">src</span><span style=\"color:#f92672\">=</span><span style=\"color:#a6e22e\">a</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">d</span>.<span style=\"color:#a6e22e\">type</span><span style=\"color:#f92672\">=</span><span style=\"color:#e6db74\">&#39;text/java&#39;</span><span style=\"color:#f92672\">+</span><span style=\"color:#a6e22e\">c</span>;<span style=\"color:#a6e22e\">d</span>.<span style=\"color:#66d9ef\">async</span><span style=\"color:#f92672\">=</span><span style=\"color:#66d9ef\">true</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">a</span><span style=\"color:#f92672\">=</span><span style=\"color:#a6e22e\">b</span>.<span style=\"color:#a6e22e\">getElementsByTagName</span>(<span style=\"color:#a6e22e\">c</span>)[<span style=\"color:#ae81ff\">0</span>];<span style=\"color:#a6e22e\">a</span>.<span style=\"color:#a6e22e\">parentNode</span>.<span style=\"color:#a6e22e\">insertBefore</span>(<span style=\"color:#a6e22e\">d</span>,<span style=\"color:#a6e22e\">a</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\">// Generate a 32-char lowercase alphanumeric visitor ID\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">function</span> <span style=\"color:#a6e22e\">generateTealiumVisitorId</span>() {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">chars</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;abcdefghijklmnopqrstuvwxyz0123456789&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> Array.<span style=\"color:#a6e22e\">from</span>({ <span style=\"color:#a6e22e\">length</span><span style=\"color:#f92672\">:</span> <span style=\"color:#ae81ff\">32</span> }, () =&gt; <span style=\"color:#a6e22e\">chars</span>[Math.<span style=\"color:#a6e22e\">floor</span>(Math.<span style=\"color:#a6e22e\">random</span>() <span style=\"color:#f92672\">*</span> <span style=\"color:#a6e22e\">chars</span>.<span style=\"color:#a6e22e\">length</span>)]).<span style=\"color:#a6e22e\">join</span>(<span style=\"color:#e6db74\">&#39;&#39;</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\">// Retrieve or create &amp; persist the visitor ID\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">tealium_visitor_id</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">localStorage</span>.<span style=\"color:#a6e22e\">getItem</span>(<span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</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_visitor_id</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\">generateTealiumVisitorId</span>();\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">localStorage</span>.<span style=\"color:#a6e22e\">setItem</span>(<span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</span>, <span style=\"color:#a6e22e\">tealium_visitor_id</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\">// App initialized\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#a6e22e\">utag</span>.<span style=\"color:#a6e22e\">track</span>(<span style=\"color:#e6db74\">&#39;event&#39;</span>, {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#e6db74\">&#39;tealium_event&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;interface_loaded&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#e6db74\">&#39;app_version&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;2.1.0&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#e6db74\">&#39;user_tier&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;enterprise&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">tealium_visitor_id</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\">// PDP view\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">function</span> <span style=\"color:#a6e22e\">trackViewPdp</span>(<span style=\"color:#a6e22e\">product</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">utag</span>.<span style=\"color:#a6e22e\">track</span>(<span style=\"color:#e6db74\">&#39;view&#39;</span>, {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_event&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;view_pdp&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;product_id&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">product</span>.<span style=\"color:#a6e22e\">id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;product_name&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">product</span>.<span style=\"color:#a6e22e\">name</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;category&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">product</span>.<span style=\"color:#a6e22e\">category</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;price&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">product</span>.<span style=\"color:#a6e22e\">price</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;currency&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">product</span>.<span style=\"color:#a6e22e\">currency</span> <span style=\"color:#f92672\">||</span> <span style=\"color:#e6db74\">&#39;USD&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">tealium_visitor_id</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:#75715e\">// Button click\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">function</span> <span style=\"color:#a6e22e\">trackButtonClick</span>(<span style=\"color:#a6e22e\">button</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">utag</span>.<span style=\"color:#a6e22e\">track</span>(<span style=\"color:#e6db74\">&#39;link&#39;</span>, {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_event&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;button_click&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;button_id&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">button</span>.<span style=\"color:#a6e22e\">id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;button_text&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">button</span>.<span style=\"color:#a6e22e\">text</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;location&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">button</span>.<span style=\"color:#a6e22e\">location</span> <span style=\"color:#f92672\">||</span> <span style=\"color:#e6db74\">&#39;pdp&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;app_version&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;2.1.0&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">tealium_visitor_id</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>&lt;/<span style=\"color:#f92672\">script</span>&gt;\n</span></span></code></pre></div><h2 id=\"option-2-server-side-tracking\">Option 2: Server-side tracking</h2>\n<p>Server-side tracking sends events directly to Tealium using the <a href=\"/platforms/http-api/endpoint/\">HTTP API</a>. Similar to the client-side solution, it generates and persists its own anonymous visitor ID using added utility functions.</p>\n<p>We recommend this approach for the following scenarios:</p>\n<ul>\n<li>When CSP restrictions prevent external JavaScript from loading.</li>\n<li>To guarantee data tracking for essential events such as purchases.</li>\n</ul>\n<p>The following server-side tracking solutions are available:</p>\n<h3 id=\"nodejs-apps-recommended\">Node.js apps (Recommended)</h3>\n<p>The Node.js solution has client code that generates and persists the anonymous visitor ID and calls wrapper functions for tracked events.</p>\n<p>For example, the following sample code generates the visitor ID and sends order tracking requests to the server. The <code>order</code> object comes from your app when a customer completes a purchase.</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\">// Generate a 32-char lowercase alphanumeric visitor ID\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span><span style=\"color:#66d9ef\">function</span> <span style=\"color:#a6e22e\">generateTealiumVisitorId</span>() {\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">chars</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;abcdefghijklmnopqrstuvwxyz0123456789&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">return</span> Array.<span style=\"color:#a6e22e\">from</span>({ <span style=\"color:#a6e22e\">length</span><span style=\"color:#f92672\">:</span> <span style=\"color:#ae81ff\">32</span> }, () =&gt; <span style=\"color:#a6e22e\">chars</span>[Math.<span style=\"color:#a6e22e\">floor</span>(Math.<span style=\"color:#a6e22e\">random</span>() <span style=\"color:#f92672\">*</span> <span style=\"color:#a6e22e\">chars</span>.<span style=\"color:#a6e22e\">length</span>)]).<span style=\"color:#a6e22e\">join</span>(<span style=\"color:#e6db74\">&#39;&#39;</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\">// Retrieve or create &amp; persist the visitor ID\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span><span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">tealium_visitor_id</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">localStorage</span>.<span style=\"color:#a6e22e\">getItem</span>(<span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</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_visitor_id</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\">generateTealiumVisitorId</span>();\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#a6e22e\">localStorage</span>.<span style=\"color:#a6e22e\">setItem</span>(<span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</span>, <span style=\"color:#a6e22e\">tealium_visitor_id</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\">async</span> <span style=\"color:#66d9ef\">function</span> <span style=\"color:#a6e22e\">trackPurchaseServer</span>(<span style=\"color:#a6e22e\">order</span>) {\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">await</span> <span style=\"color:#a6e22e\">fetch</span>(<span style=\"color:#e6db74\">&#39;/api/tealium/track&#39;</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\">headers</span><span style=\"color:#f92672\">:</span> { <span style=\"color:#e6db74\">&#39;Content-Type&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;application/json&#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\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>({\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_event&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;purchase&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">tealium_visitor_id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;order_id&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">order</span>.<span style=\"color:#a6e22e\">id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;order_total&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">order</span>.<span style=\"color:#a6e22e\">total</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;currency&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">order</span>.<span style=\"color:#a6e22e\">currency</span> <span style=\"color:#f92672\">||</span> <span style=\"color:#e6db74\">&#39;USD&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;items&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">order</span>.<span style=\"color:#a6e22e\">items</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></code></pre></div><p>The following sample server-side code sets up an endpoint to accept tracking calls and uses <a href=\"/platforms/node/install/\">Tealium for Node.js</a> to forward those events on to Tealium Collect.</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\">// npm i tealium-collect express\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span><span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">express</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">require</span>(<span style=\"color:#e6db74\">&#39;express&#39;</span>);\n</span></span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">TealiumCollect</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">require</span>(<span style=\"color:#e6db74\">&#39;tealium-collect&#39;</span>);\n</span></span><span style=\"display:flex;\"><span><span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">app</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">express</span>();\n</span></span><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">app</span>.<span style=\"color:#a6e22e\">use</span>(<span style=\"color:#a6e22e\">express</span>.<span style=\"color:#a6e22e\">json</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</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">new</span> <span style=\"color:#a6e22e\">TealiumCollect</span>({\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#e6db74\">&#39;account&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;your-account&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#e6db74\">&#39;profile&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;chatgpt-app&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#e6db74\">&#39;environment&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;prod&#39;</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\">app</span>.<span style=\"color:#a6e22e\">post</span>(<span style=\"color:#e6db74\">&#39;/api/tealium/track&#39;</span>, <span style=\"color:#66d9ef\">async</span> (<span style=\"color:#a6e22e\">req</span>, <span style=\"color:#a6e22e\">res</span>) =&gt; {\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#66d9ef\">try</span> {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">tealium_visitor_id</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">req</span>.<span style=\"color:#a6e22e\">body</span>.<span style=\"color:#a6e22e\">tealium_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:#e6db74\">/^[a-z0-9]{32}$/</span>.<span style=\"color:#a6e22e\">test</span>(<span style=\"color:#a6e22e\">tealium_visitor_id</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\">return</span> <span style=\"color:#a6e22e\">res</span>.<span style=\"color:#a6e22e\">status</span>(<span style=\"color:#ae81ff\">400</span>).<span style=\"color:#a6e22e\">json</span>({ <span style=\"color:#a6e22e\">error</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;Invalid or missing tealium_visitor_id&#39;</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\">allowed</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#66d9ef\">new</span> <span style=\"color:#a6e22e\">Set</span>([<span style=\"color:#e6db74\">&#39;interface_loaded&#39;</span>,<span style=\"color:#e6db74\">&#39;view_pdp&#39;</span>,<span style=\"color:#e6db74\">&#39;button_click&#39;</span>,<span style=\"color:#e6db74\">&#39;purchase&#39;</span>]);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">if</span> (<span style=\"color:#f92672\">!</span><span style=\"color:#a6e22e\">allowed</span>.<span style=\"color:#a6e22e\">has</span>(<span style=\"color:#a6e22e\">req</span>.<span style=\"color:#a6e22e\">body</span>.<span style=\"color:#a6e22e\">tealium_event</span>)) {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">res</span>.<span style=\"color:#a6e22e\">status</span>(<span style=\"color:#ae81ff\">400</span>).<span style=\"color:#a6e22e\">json</span>({ <span style=\"color:#a6e22e\">error</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;Unsupported event type&#39;</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\">await</span> <span style=\"color:#a6e22e\">tealium</span>.<span style=\"color:#a6e22e\">track</span>({\n</span></span><span style=\"display:flex;\"><span>      ...<span style=\"color:#a6e22e\">req</span>.<span style=\"color:#a6e22e\">body</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#a6e22e\">tealium_visitor_id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;timestamp&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">req</span>.<span style=\"color:#a6e22e\">body</span>.<span style=\"color:#a6e22e\">timestamp</span> <span style=\"color:#f92672\">||</span> <span style=\"color:#66d9ef\">new</span> Date().<span style=\"color:#a6e22e\">toISOString</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\">res</span>.<span style=\"color:#a6e22e\">status</span>(<span style=\"color:#ae81ff\">204</span>).<span style=\"color:#a6e22e\">end</span>();\n</span></span><span style=\"display:flex;\"><span>  } <span style=\"color:#66d9ef\">catch</span> (<span style=\"color:#a6e22e\">e</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\">&#39;Tealium track error:&#39;</span>, <span style=\"color:#a6e22e\">e</span>);\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">res</span>.<span style=\"color:#a6e22e\">status</span>(<span style=\"color:#ae81ff\">500</span>).<span style=\"color:#a6e22e\">json</span>({ <span style=\"color:#a6e22e\">error</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;Tracking failed&#39;</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:#a6e22e\">app</span>.<span style=\"color:#a6e22e\">listen</span>(<span style=\"color:#ae81ff\">3000</span>, () =&gt; <span style=\"color:#a6e22e\">console</span>.<span style=\"color:#a6e22e\">log</span>(<span style=\"color:#e6db74\">&#39;Tealium server listening on 3000&#39;</span>));\n</span></span></code></pre></div><h3 id=\"browser-apps\">Browser apps</h3>\n<p>Use this approach for browser apps where you have access to embed <code>&lt;script&gt;</code> tags. This code uses <code>fetch()</code> and the <a href=\"/platforms/http-api/endpoint/\">HTTP API</a> to send events directly to Tealium and uses the same utility methods to generate and persist an anonymous visitor ID.</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-html\" data-lang=\"html\"><span style=\"display:flex;\"><span>&lt;<span style=\"color:#f92672\">script</span>&gt;\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#75715e\">// Generate a 32-char lowercase alphanumeric visitor ID\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">function</span> <span style=\"color:#a6e22e\">generateTealiumVisitorId</span>() {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">const</span> <span style=\"color:#a6e22e\">chars</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#e6db74\">&#39;abcdefghijklmnopqrstuvwxyz0123456789&#39;</span>;\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> Array.<span style=\"color:#a6e22e\">from</span>({ <span style=\"color:#a6e22e\">length</span><span style=\"color:#f92672\">:</span> <span style=\"color:#ae81ff\">32</span> }, () =&gt; <span style=\"color:#a6e22e\">chars</span>[Math.<span style=\"color:#a6e22e\">floor</span>(Math.<span style=\"color:#a6e22e\">random</span>() <span style=\"color:#f92672\">*</span> <span style=\"color:#a6e22e\">chars</span>.<span style=\"color:#a6e22e\">length</span>)]).<span style=\"color:#a6e22e\">join</span>(<span style=\"color:#e6db74\">&#39;&#39;</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\">// Retrieve or create &amp; persist the visitor ID\n</span></span></span><span style=\"display:flex;\"><span><span style=\"color:#75715e\"></span>  <span style=\"color:#66d9ef\">let</span> <span style=\"color:#a6e22e\">tealium_visitor_id</span> <span style=\"color:#f92672\">=</span> <span style=\"color:#a6e22e\">localStorage</span>.<span style=\"color:#a6e22e\">getItem</span>(<span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</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_visitor_id</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\">generateTealiumVisitorId</span>();\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#a6e22e\">localStorage</span>.<span style=\"color:#a6e22e\">setItem</span>(<span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</span>, <span style=\"color:#a6e22e\">tealium_visitor_id</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\">async</span> <span style=\"color:#66d9ef\">function</span> <span style=\"color:#a6e22e\">sendCollectEvent</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\">base</span> <span style=\"color:#f92672\">=</span> {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_account&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;your-account&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_profile&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;chatgpt-app&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_visitor_id&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">tealium_visitor_id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;timestamp&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#66d9ef\">new</span> Date().<span style=\"color:#a6e22e\">toISOString</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\">await</span> <span style=\"color:#a6e22e\">fetch</span>(<span style=\"color:#e6db74\">&#39;https://collect.tealiumiq.com/event&#39;</span>, {\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;method&#39;</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:#e6db74\">&#39;headers&#39;</span><span style=\"color:#f92672\">:</span> { <span style=\"color:#e6db74\">&#39;Content-Type&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;application/json&#39;</span> },\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;body&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">JSON</span>.<span style=\"color:#a6e22e\">stringify</span>({ ...<span style=\"color:#a6e22e\">base</span>, ...<span style=\"color:#a6e22e\">payload</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\">function</span> <span style=\"color:#a6e22e\">trackViewPdpServer</span>(<span style=\"color:#a6e22e\">product</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">sendCollectEvent</span>({\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_event&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;view_pdp&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;product_id&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">product</span>.<span style=\"color:#a6e22e\">id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;product_name&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">product</span>.<span style=\"color:#a6e22e\">name</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;product_category&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">product</span>.<span style=\"color:#a6e22e\">category</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;product_price&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">product</span>.<span style=\"color:#a6e22e\">price</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;product_currency&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">product</span>.<span style=\"color:#a6e22e\">currency</span> <span style=\"color:#f92672\">||</span> <span style=\"color:#e6db74\">&#39;USD&#39;</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\">function</span> <span style=\"color:#a6e22e\">trackButtonClickServer</span>(<span style=\"color:#a6e22e\">button</span>) {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#66d9ef\">return</span> <span style=\"color:#a6e22e\">sendCollectEvent</span>({\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;tealium_event&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;button_click&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;button_id&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">button</span>.<span style=\"color:#a6e22e\">id</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;button_text&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">button</span>.<span style=\"color:#a6e22e\">text</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;location&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#a6e22e\">button</span>.<span style=\"color:#a6e22e\">location</span> <span style=\"color:#f92672\">||</span> <span style=\"color:#e6db74\">&#39;pdp&#39;</span>,\n</span></span><span style=\"display:flex;\"><span>      <span style=\"color:#e6db74\">&#39;app_version&#39;</span><span style=\"color:#f92672\">:</span> <span style=\"color:#e6db74\">&#39;2.1.0&#39;</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>&lt;/<span style=\"color:#f92672\">script</span>&gt;\n</span></span></code></pre></div><h2 id=\"option-3-hybrid-recommended\">Option 3: Hybrid (Recommended)</h2>\n<p>A hybrid approach uses the client-side solution to track interaction events, such as  <code>interface_loaded</code>, <code>view_pdp</code>, and <code>button_click</code>, and the server-side solution to track authoritative events such as <code>purchase</code>. We recommend this approach to achieve the most complete tracking of your app.</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>When running the hybrid solution, do not load the Tealium Collect tag in your iQ profile. This prevents duplicate event tracking.</p>\n<h2 id=\"visitor-identity\">Visitor identity</h2>\n<p>To ensure accurate tracking and a unified visitor profile, always use the same anonymous visitor ID for both client-side and server-side events. This approach maintains a single visitor identity across ChatGPT, web, and mobile, enabling consistent tracking and real-time personalization.</p>\n<p class=\"tip\"><i class=\"fa fa-info-circle\"></i>We recommend including known user identifiers as separate parameters when available, for example <code>customer_id</code> or <code>email_address_hash</code>, but do not use these values to replace <code>tealium_visitor_id</code>.</p>\n<h2 id=\"mcp-integration-optional\">MCP integration (Optional)</h2>\n<p>Expose a simple MCP tool from your server for ChatGPT to call. This approach lets ChatGPT handle conversational logic, while your server enforces format, identity, and policy.</p>\n<p><strong>Tool:</strong> <code>tealium-track-event</code></p>\n<p><strong>Example schema:</strong></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;account&#34;</span>: <span style=\"color:#e6db74\">&#34;your-account&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;profile&#34;</span>: <span style=\"color:#e6db74\">&#34;chatgpt-app&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;environment&#34;</span>: <span style=\"color:#e6db74\">&#34;prod&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;event&#34;</span>: <span style=\"color:#e6db74\">&#34;view_pdp&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;visitorId&#34;</span>: <span style=\"color:#e6db74\">&#34;abcdefghijklmnopqrstuvwxyz012345&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>  <span style=\"color:#f92672\">&#34;data&#34;</span>: {\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;product_id&#34;</span>: <span style=\"color:#e6db74\">&#34;widget-123&#34;</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;price&#34;</span>: <span style=\"color:#ae81ff\">29.99</span>,\n</span></span><span style=\"display:flex;\"><span>    <span style=\"color:#f92672\">&#34;currency&#34;</span>: <span style=\"color:#e6db74\">&#34;USD&#34;</span>\n</span></span><span style=\"display:flex;\"><span>  }\n</span></span><span style=\"display:flex;\"><span>}\n</span></span></code></pre></div><p><strong>Validation:</strong></p>\n<ul>\n<li><code>visitorId</code> must match the regular expression <code>/^[a-z0-9]{32}$/</code>.</li>\n<li><code>event</code> must be in list of allowed events (<code>interface_loaded</code>, <code>view_pdp</code>, <code>button_click</code>, <code>purchase</code>).</li>\n</ul>\n<h2 id=\"moments-api-mcp\">Moments API MCP</h2>\n<p>Add the <a href=\"/server-side/moments-api/managed-mcp-server/\">Moments MCP server</a> to your app to enable personalization.</p>\n<p><strong>Example flow:</strong></p>\n<ol>\n<li>Track events <code>view_pdp</code>, <code>button_click</code>, and <code>purchase</code>.</li>\n<li><strong>AudienceStream</strong> builds the visitor profile.</li>\n<li>Chat UI (or MCP tool) queries <strong>Moments API</strong> with <code>tealium_visitor_id</code>.</li>\n<li>Responses adapt (recommendations, offers, tone).</li>\n</ol>\n<h2 id=\"data-privacy-and-compliance\">Data privacy and compliance</h2>\n<p>This app supports data privacy and compliance through the following features:</p>\n<ul>\n<li>Consent-driven activation through the Tealium iQ Consent Manager.</li>\n<li>PII governance through omitting or hashing before transmitting data.</li>\n<li>Regional compliance (GDPR, CCPA, and data residency).</li>\n</ul>\n<h2 id=\"sample-app\">Sample app</h2>\n<h3 id=\"prerequisites\">Prerequisites</h3>\n<ul>\n<li>Node.js 18+ (LTS)</li>\n<li><code>npm</code> or <code>pnpm</code></li>\n<li>Tealium account, profile, and environment</li>\n<li>(Optional) ngrok for MCP exposure</li>\n</ul>\n<h3 id=\"install\">Install</h3>\n<ol>\n<li>Install dependencies for the main project:\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-bash\" data-lang=\"bash\"><span style=\"display:flex;\"><span>pnpm install\n</span></span></code></pre></div></li>\n<li>Install dependencies for the server:\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-bash\" data-lang=\"bash\"><span style=\"display:flex;\"><span>cd server\n</span></span><span style=\"display:flex;\"><span>pnpm install\n</span></span><span style=\"display:flex;\"><span>cd ..\n</span></span></code></pre></div></li>\n</ol>\n<h3 id=\"run-the-application\">Run the application</h3>\n<ol>\n<li>Build the frontend bundle:\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-sh\" data-lang=\"sh\"><span style=\"display:flex;\"><span>pnpm run build  \n</span></span></code></pre></div></li>\n<li>Start the MCP server:\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-sh\" data-lang=\"sh\"><span style=\"display:flex;\"><span>cd server  \n</span></span><span style=\"display:flex;\"><span>pnpm start\n</span></span></code></pre></div></li>\n<li>The server runs at <a href=\"http://localhost:8000/mcp\">http://localhost:8000/mcp</a></li>\n<li>Generate an ngrok tunnel (in a new terminal):\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-sh\" data-lang=\"sh\"><span style=\"display:flex;\"><span>ngrok http <span style=\"color:#ae81ff\">8000</span>  \n</span></span></code></pre></div></li>\n<li>ngrok returns the following output:\n<pre tabindex=\"0\"><code class=\"language-none\" data-lang=\"none\">Session Status    online  \nAccount           Your Account (Plan: Free)  \nUpdate            update available (version 3.x.x, Ctrl-C to update)  \nVersion           3.x.x  \nRegion            United States (us)  \nWeb Interface     http://127.0.0.1:4040  \nForwarding        https://abc123def456.ngrok-free.app -&gt; http://localhost:8000  \n</code></pre></li>\n<li>Update the CSP domains in server code:\n<ul>\n<li>Copy the ngrok URL from the terminal output (for example: <code>https://abc123def456.ngrok-free.app</code>).</li>\n<li>In <code>server/index.ts</code> on lines 30 and 34, replace <code>https://resolvedly-pouched-nena.ngrok-free.dev</code> with your new ngrok URL.</li>\n<li>Make the same update in <code>src/tealium/TealiumTracker.tsx</code> on line 134.</li>\n</ul>\n</li>\n<li>Restart the server:\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-sh\" data-lang=\"sh\"><span style=\"display:flex;\"><span><span style=\"color:#75715e\"># Kill the current server (Ctrl+C)</span>\n</span></span><span style=\"display:flex;\"><span>cd server\n</span></span><span style=\"display:flex;\"><span>pnpm start\n</span></span></code></pre></div></li>\n<li>Rebuild the frontend with the new URL:\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-sh\" data-lang=\"sh\"><span style=\"display:flex;\"><span>cd ..  \n</span></span><span style=\"display:flex;\"><span>pnpm run build\n</span></span></code></pre></div></li>\n</ol>\n<p>Make note of the following access points:</p>\n<ul>\n<li>Local MCP Server: <a href=\"http://localhost:8000/mcp\">http://localhost:8000/mcp</a></li>\n<li>Health Check: <a href=\"http://localhost:8000/health\">http://localhost:8000/health</a></li>\n<li>API Endpoint: <a href=\"http://localhost:8000/api/tealium/track\">http://localhost:8000/api/tealium/track</a></li>\n<li>Public ngrok URL: ngrok URL + <code>/mcp</code></li>\n<li>Public API: ngrok URL + <code>/api/tealium/track</code></li>\n</ul>\n<h3 id=\"add-the-app-in-chatgpt\">Add the app in ChatGPT</h3>\n<ol>\n<li>Go to <strong>ChatGPT &gt; Settings &gt; Apps and Connectors</strong>.</li>\n<li>Enable <strong>Developer Mode</strong> under <strong>Advanced Settings</strong>.</li>\n<li>Paste your <strong>ngrok URL</strong> in the <strong>MCP server field</strong>.</li>\n</ol>\n<h3 id=\"launch-the-tealium-app\">Launch the Tealium app</h3>\n<ol>\n<li>When prompted, use the <code>tealium-tracker</code> tool.</li>\n<li>Enter your Tealium account, profile, and environment.</li>\n<li>The Tealium Universal tag (<code>utag.js</code>) loads and tracks events as if in a web app.</li>\n</ol>\n<p class=\"tip\"><i class=\"fa fa-info-circle\"></i>If third-party libraries are blocked, allow their resources in your CSP.</p>\n<h3 id=\"server-side-event-tracking\"><strong>Server-side event tracking</strong></h3>\n<p>Turning on server-side tracking sends client-side calls to <code>/api/tealium/track</code>, which uses the Tealium Collect NPM module to make tracking requests.</p>\n<figure><a class=\"slb\" href=\"/images/guides/tealium-chatgpt-tracker-app.png\"><img src=\"https://docs.tealium.com/images/guides/tealium-chatgpt-tracker-app.png\"/>\n    </a>\n</figure>\n<p>Validate results in <a href=\"/server-side/trace/about/\">Tealium Trace</a>.</p>\n<figure><a class=\"slb\" href=\"/images/guides/tealium-chatgpt-trace.png\"><img src=\"https://docs.tealium.com/images/guides/tealium-chatgpt-trace.png\"/>\n    </a>\n</figure>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/server-side-connectors/google-vertex-ai-connector/",
            "title": "Google Vertex AI Setup Guide",
            "body": "<p class=\"tip\"><i class=\"fa fa-info-circle\"></i>For an overview of how AI connectors work and guidance on when to use an AI connector or Tealium functions, see <a href=\"/guides/ai-connectors-and-functions/\">AI connectors and Tealium functions</a>.</p>\n<h2 id=\"how-it-works\">How it works</h2>\n<p>This connector invokes an AI model with your custom prompt and mapped Tealium data, then sends the response as a JSON event back to Tealium Collect for real-time enrichment.</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>The connector should be used for targeted, high-value interactions rather than high-volume events. Excessive usage may result in rate limits or increased API costs in your vendor account and add to your inbound Tealium event volume.</p>\n<h2 id=\"usage-and-cost-considerations\">Usage and cost considerations</h2>\n<p>Before activating the Google Vertex AI connector, review your Google Cloud quotas and limits. The connector can generate a high volume of requests depending on your event and audience triggers, which may result in unexpected usage or overage costs.</p>\n<p>For more information, see <a href=\"https://docs.cloud.google.com/vertex-ai/docs/quotas\">Google: Vertex AI quotas and limits</a>.</p>\n<p><strong>Key considerations</strong></p>\n<ul>\n<li><strong>Usage tier and rate limits</strong><br>\nGoogle Vertex AI enforces rate limits based on your account tier (requests per minute and tokens per minute). High‑frequency events or large audiences can quickly reach these limits, causing throttling or failed requests.</li>\n<li><strong>Pricing and token consumption</strong><br>\nGoogle Vertex AI charges based on the number of input and output tokens processed by the model. Longer prompts, larger payloads, and higher‑capacity models increase per‑request cost. Review pricing for the specific models you plan to use.</li>\n<li><strong>Monthly spend and budget controls</strong><br>\nSet usage caps or alerts in your Google Cloud account to prevent unplanned spend. Without limits in place, automated workflows can accumulate significant costs.</li>\n<li><strong>Trigger volume</strong>\nAvoid attaching the connector to high‑volume, low‑value events (such as page views). Use events or audiences that represent meaningful customer actions and occur at manageable frequency.</li>\n</ul>\n<h2 id=\"best-practices\">Best practices</h2>\n<p>To get the most value from this connector, follow these guidelines to build effective solutions:</p>\n<ul>\n<li><strong>High-value triggers</strong>: Choose event feed or audience triggers that contain rich context or meaningful customer input. Triggering this connector for a high-volume use case may incur additional costs in your Google Cloud account or lead to failed requests.</li>\n<li><strong>Be specific</strong>: Include details about what the model should evaluate and what values you expect. List the exact values you expect.</li>\n<li><strong>JSON format</strong>: Include a valid JSON response template that can be sent as a Tealium event.</li>\n<li><strong>Response values</strong>: Reference the response values to capture. For example, if your prompt asks to evaluate the purchase intent, reference <code>&lt;customer purchase intent&gt;</code> in the prompt where you want that value to appear in the event JSON.</li>\n<li><strong>Tealium data</strong>: Reference Tealium data and mapped parameters using double-curly braces. For example, to reference the mapped value for <code>tealium_account</code>, write <code>{{tealium_account}}</code> in your prompt.</li>\n</ul>\n<h2 id=\"api-information\">API information</h2>\n<p>This connector uses the following vendor API:</p>\n<ul>\n<li>API Name: Vertex API</li>\n<li>API Version: v1</li>\n<li>API Endpoint: <code>https://aiplatform.googleapis.com/v1</code></li>\n<li>Documentation: <a href=\"https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/projects.locations.endpoints/generateContent\">Google API</a></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>Google Cloud Platform Project ID</strong>: (Required) Your Google Cloud project ID with Vertex AI enabled.</li>\n<li><strong>Private key JSON file</strong>: (Required) Paste the content of the JSON key generated for your Service Account. Grant the service account the Vertex AI User role (<code>roles/aiplatform.user</code>) in the project. This role allows the connector to both list available models and invoke the selected model through the Vertex AI Generative APIs.</li>\n<li><strong>Location</strong>: Select the Vertex AI location where your model runs. Use <strong>global</strong> for Google publisher Gemini models. Choose a regional location if required for data residency or if your Vertex resources are regional.</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 Prompt to Vertex AI</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.</p>\n<p>The following section describes how to set up parameters and options for each action.</p>\n<h3 id=\"send-prompt-to-vertex-ai\">Send Prompt to Vertex AI</h3>\n<p>This action invokes a Vertex AI model with your custom prompt and mapped Tealium data. If the model responds with a valid JSON event object, this event is sent back to your account where you can capture the generated value in a real-time enrichment.</p>\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>Model</td>\n<td><ul><li>Select the Vertex model to use for this prompt.</li><li>The list shows Google&rsquo;s Gemini generative models that are suitable for text or JSON-style responses.</li><li>If your team uses a private or fine-tuned Vertex AI model, you can enter its model resource name manually (for example: <code>projects/{{PROJECT}}/locations/{{REGION}}/models/{{MODEL_ID}}</code>).</li><li>We recommend using a model that is optimized for structured output (JSON) and supports your performance and cost requirements.</li></ul></td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"prompt-parameters\">Prompt 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>Add Event Payload</td>\n<td>(Available for event actions) Check this box to include the event payload for use in the prompt template as variable <code>{{event_payload}}</code>.</td>\n</tr>\n<tr>\n<td>Add Visitor Profile</td>\n<td>(Available for audience actions) Check this box to include the visitor profile for use in the prompt template as variable <code>{{visitor_profile}}</code>.</td>\n</tr>\n<tr>\n<td>Add Current Visit</td>\n<td>(Available for audience actions) Check this box to include the current visit within the variable <code>{{visitor_profile}}</code>.</td>\n</tr>\n<tr>\n<td>Prompt</td>\n<td><ul><li>Enter the prompt to send to the selected Vertex AI model. Use the guidelines below to ensure consistent and machine-readable output:</li><li>Use double curly braces to reference mapped parameters, for example: <code>{{tealium_account}}</code>, <code>{{visitor_id}}</code>, <code>{{event_value}}</code>.</li><li>When using a visitor action, use <code>{{visitor_profile}}</code> to include the visitor profile in the prompt after first enabling the <strong>Add Visitor Profile</strong> checkbox.</li><li>Avoid ambiguous phrasing; prompts should be deterministic so the output can be parsed reliably.</li><li>Define the JSON fields and structure you expect in the response.</li><li>Explicitly instruct the model to return <code>tealium_account</code>, <code>tealium_profile</code>, and <code>tealium_visitor_id</code> in its response in order for the connector to correctly parse and forward the response to the Collect endpoint.</li><li>The connector will include <code>response_mime_type</code>: <code>application/json</code> in the request to force the model to return JSON.</li><li>For more information and examples, refer to the Tealium documentation for this connector.</li></ul></td>\n</tr>\n<tr>\n<td>Debug Mode</td>\n<td>When debug mode is enabled, the connector accepts the raw Vertex AI response without sending it to Tealium Collect. Use a trace to validate the response format before enabling full processing.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"advanced-model-settings\">Advanced Model Settings</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><code>temperature</code></td>\n<td>Controls randomness and creativity. A lower value results in a sharper distribution curve with more focused and predictable answers, while a higher value results in a flatter distribution curve and more varied and creative answers. Allowed values are between <code>0</code> and <code>2</code>.</td>\n</tr>\n<tr>\n<td><code>maxOutputTokens</code></td>\n<td>The maximum number of tokens to generate in the response.</td>\n</tr>\n<tr>\n<td><code>topP</code></td>\n<td>Specifies the nucleus sampling threshold.  A lower <code>topP</code> value is safer and more focused, while a higher <code>topP</code> value is more varied and creative. Allowed values are between <code>0</code> and <code>1</code>. For example, if <code>topP</code> is set to <code>0.9</code>, only tokens whose cumulative probability reaches 90% are considered and low‑probability tail tokens are dropped.</td>\n</tr>\n<tr>\n<td><code>topK</code></td>\n<td>Specifies the top-k sampling threshold. A lower <code>topK</code> value is more deterministic and less diverse, while a higher <code>topK</code> value is more diverse but potentially less coherent. For example, if <code>topK</code> is set to <code>40</code>, the next token is chosen (probabilistically, using temperature) from only the 40 highest‑probability tokens and everything else is ignored.</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/server-side-connectors/google-vertex-commerce-connector/",
            "title": "Google Vertex AI Search for Commerce Connector Setup Guide",
            "body": "<h2 id=\"api-information\">API Information</h2>\n<p>This connector uses the following vendor API:</p>\n<ul>\n<li>API Name: Google API</li>\n<li>API Version: v2</li>\n<li>API Endpoint: <code>https://retail.googleapis.com</code></li>\n<li>Documentation: <a href=\"https://cloud.google.com/solutions/vertex-ai-search-commerce\">Vertex AI Search for commerce</a></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>Google Cloud Platform Project ID</strong>: (Required) Your Google Cloud project ID. The project must have Vertex Search AI enabled.</li>\n<li><strong>Private key JSON file</strong>: (Required) Paste the JSON key generated for your service account. The service account requires access to <code>retail.userEvents.import</code>. Google recommends using the Retail Editor role.</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>Write User Event</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.</p>\n<p>The following section describes how to set up parameters and options for each action.</p>\n<h3 id=\"write-user-event\">Write User Event</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>Catalog</td>\n<td>Select the Vertex AI Search for Commerce catalog where user events are recorded.</td>\n</tr>\n<tr>\n<td>Event Type</td>\n<td>Choose the type of user event to send to Vertex AI Search for Commerce. This determines how the event is interpreted and which fields are required in the payload.<ul><li><code>add-to-cart</code></li><li><code>remove-from-cart</code></li><li><code>category-page-view</code></li><li><code>detail-page-view</code></li><li><code>home-page-view</code></li><li><code>purchase-complete</code></li><li><code>search</code></li><li><code>shopping-cart-page-view</code></li></ul></td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"event-data\">Event 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>Attributes</td>\n<td>Map extra user event features to include in the recommendation model</td>\n</tr>\n<tr>\n<td>Template Variables</td>\n<td><ul><li>(Optional) Provide template variables as data input for templates. For more information, see <a href=\"/server-side/connectors/templates/template-variables/\">Connector template variables</a>.</li><li>Name nested template variables with the dot notation. For example: <code>items.name</code></li><li>Nested template variables are typically built from data layer list attributes.</li></ul></td>\n</tr>\n<tr>\n<td>Templates</td>\n<td><ul><li>(Optional) Provide templates to be referenced in either URL, URL Parameter, Header, or Body Data. For more information, see <a href=\"/server-side/connectors/templates/about/\">About connector templates</a>.</li><li>Templates are injected by name with double curly braces into supported fields. For example, <code>{{SomeTemplateName}}</code>.</li><li>When using OAuth, the template variable <code>{{webhook_access_token}}</code> refers to the token returned by the authentication request.</li></ul></td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/server-side-connectors/openai-connector/",
            "title": "OpenAI Connector Setup Guide",
            "body": "<p class=\"tip\"><i class=\"fa fa-info-circle\"></i>For an overview of how AI connectors work and guidance on when to use an AI connector or Tealium functions, see <a href=\"/guides/ai-connectors-and-functions/\">AI connectors and Tealium functions</a>.</p>\n<h2 id=\"how-it-works\">How it works</h2>\n<p>This connector invokes an OpenAI model with your custom prompt and mapped Tealium data, then sends the response as a JSON event to Tealium Collect for real-time enrichment.</p>\n<p class=\"note\"><i class=\"fa fa-exclamation-triangle\"></i>The OpenAI connector should be used for targeted, high-value interactions rather than high-volume events. Excessive usage may result in rate limits or increased API costs in your OpenAI account and add to your inbound Tealium event volume.</p>\n<h2 id=\"usage-and-cost-considerations\">Usage and cost considerations</h2>\n<p>Before activating the OpenAI connector, review your OpenAI account limits, usage tier, and pricing model. The connector can generate a high volume of requests depending on your event and audience triggers, which may result in unexpected usage or overage costs.</p>\n<p>For more information, see <a href=\"https://developers.openai.com/api/docs/guides/rate-limits\">OpenAI Developers: Rate limits</a>.</p>\n<p><strong>Key considerations</strong></p>\n<ul>\n<li><strong>Usage tier and rate limits</strong><br>\nOpenAI enforces rate limits based on your account tier (requests per minute and tokens per minute). High‑frequency events or large audiences can quickly reach these limits, causing throttling or failed requests.</li>\n<li><strong>Pricing and token consumption</strong><br>\nOpenAI charges based on the number of input and output tokens processed by the model. Longer prompts, larger payloads, and higher‑capacity models increase per‑request cost. Review pricing for the specific models you plan to use.</li>\n<li><strong>Monthly spend and budget controls</strong><br>\nSet usage caps or alerts in your OpenAI account to prevent unplanned spend. Without limits in place, automated workflows can accumulate significant costs.</li>\n<li><strong>Trigger volume</strong><br>\nAvoid attaching the connector to high‑volume, low‑value events (such as page views). Use events or audiences that represent meaningful customer actions and occur at manageable frequency.</li>\n</ul>\n<h2 id=\"best-practices\">Best practices</h2>\n<p>To get the most value from this connector, follow these guidelines to build effective solutions:</p>\n<ul>\n<li><strong>High-value triggers</strong>: Choose event feed or audience triggers that contain rich context or meaningful customer input. Triggering this connector for a high-volume use case may incur additional costs in your OpenAI account or lead to failed requests.</li>\n<li><strong>Be specific</strong>: Include details about what the model should evaluate and what values you expect. List the exact values you expect.</li>\n<li><strong>JSON format</strong>: Include a valid JSON response template that can be sent as a Tealium event.</li>\n<li><strong>Response values</strong>: Reference the response values to capture. For example, if your prompt asks to evaluate the purchase intent, reference <code>&lt;customer purchase intent&gt;</code> in the prompt where you want that value to appear in the event JSON.</li>\n<li><strong>Tealium data</strong>: Reference Tealium data and mapped parameters using double-curly braces. For example, to reference the mapped value for <code>tealium_account</code>, write <code>{{tealium_account}}</code> in your prompt.</li>\n</ul>\n<h2 id=\"api-information\">API information</h2>\n<p>This connector uses the following vendor API:</p>\n<ul>\n<li>API Name: OpenAI API</li>\n<li>API Version: v1</li>\n<li>API Endpoint: <code>https://api.openai.com/v1</code></li>\n<li>Documentation: <a href=\"https://platform.openai.com/docs/api-reference\">OpenAI API</a></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>API Key</strong>: The OpenAI API key used to authenticate requests made by this connector to the OpenAI API. The key must have permission to create responses (model inference) using either <strong>All</strong> or <strong>Restricted</strong> permission. It cannot have <strong>Read Only</strong> permission. For more information, see <a href=\"https://help.openai.com/en/articles/8867743-assign-api-key-permissions\">OpenAI: Assign API Key Permissions</a>.</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 Prompt to OpenAI</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✓</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"send-prompt-to-openai\">Send Prompt to OpenAI</h3>\n<p>This action invokes an OpenAI model with your custom prompt and mapped Tealium data. If the model responds with a valid JSON event object, this event is sent back to your account where you can capture the generated value in a real-time enrichment.</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>Model</td>\n<td>Select the OpenAI model to use for this prompt, for example <strong>gpt-4.1-mini</strong> or <strong>gpt-4.1</strong>.<br>We recommend using a model optimized for structured output (JSON) that supports your performance and cost requirements. For more information, see <a href=\"https://developers.openai.com/api/docs/guides/production-best-practices\">OpenAI Developers: Production best practices</a>.</td>\n</tr>\n<tr>\n<td>Add Event Payload</td>\n<td>(Available for event actions) Check this box to include the event payload for use in the prompt template as variable <code>{{event_payload}}</code>.</td>\n</tr>\n<tr>\n<td>Add Visitor Profile</td>\n<td>(Available for audience actions) Check this box to include the visitor profile for use in the prompt template as variable <code>{{visitor_profile}}</code>.</td>\n</tr>\n<tr>\n<td>Add Current Visit</td>\n<td>(Available for audience actions) Check this box to include the current visit within the variable <code>{{visitor_profile}}</code>.</td>\n</tr>\n<tr>\n<td>Prompt</td>\n<td>Enter the prompt to send to the selected OpenAI model. Follow these guidelines to ensure consistent and machine-readable output:<br><br>Use <strong>double curly braces</strong> (<code>{{ }}</code>) to reference mapped parameters, for example: <code>{{tealium_account}}</code>, <code>{{tealium_visitor_id}}</code>, <code>{{visitor_profile}}</code>.<br><br>Use <code>{{event_payload}}</code> to include the event payload in the prompt after first enabling the <strong>Add Event Payload</strong> checkbox.<br><br>Avoid ambiguous phrasing; prompts should be deterministic so the output can be parsed reliably.<br><br>Define a valid Tealium event JSON object to be returned in the response. Explicitly instruct the model to include <code>tealium_account</code>, <code>tealium_profile</code>, and <code>tealium_visitor_id</code> and your output variable in this event JSON so the connector can forward the event to the Tealium Collect endpoint.<br><br>The connector automatically includes instructions in the prompt to force the model to return JSON.<br><br>For example prompts, see <a href=\"#how-it-works\">How it works</a>.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"advanced-model-settings\">Advanced Model Settings</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><code>temperature</code></td>\n<td>Controls randomness and creativity.</td>\n</tr>\n<tr>\n<td><code>max_output_tokens</code></td>\n<td>The maximum number of tokens the model can generate.</td>\n</tr>\n<tr>\n<td><code>max_tool_calls</code></td>\n<td>The maximum number of total calls to built-in tools that can be processed in a response.</td>\n</tr>\n<tr>\n<td><code>top_p</code></td>\n<td>Controls diversity by sampling only from the top-p probability mass.</td>\n</tr>\n<tr>\n<td><code>parallel_tool_calls</code></td>\n<td>Whether to allow the model to run tool calls in parallel. Defaults to <code>true</code>.</td>\n</tr>\n<tr>\n<td><code>prompt_cache_key</code></td>\n<td>Used by OpenAI to cache responses for similar requests to optimize your cache hit rates.</td>\n</tr>\n<tr>\n<td><code>service_tier</code></td>\n<td>Specifies the processing type used for serving the request.</td>\n</tr>\n<tr>\n<td><code>tool_choice</code></td>\n<td>How the model should select which tool or tools to use when generating a response.</td>\n</tr>\n<tr>\n<td>Debug Mode</td>\n<td>When debug mode is enabled, the connector accepts the raw OpenAI response without sending it to Tealium Collect. Use trace to validate the response format before enabling full processing.</td>\n</tr>\n</tbody>\n</table>\n"
        }  

    , 
        {
            "weight": "0",
            "url": "https://docs-preview.tealium.com/server-side-connectors/openai-events-connector/",
            "title": "OpenAI Events Connector Setup Guide",
            "body": "<h2 id=\"api-information\">API information</h2>\n<p>This connector uses the following vendor API:</p>\n<ul>\n<li>API Name: OpenAI Events API</li>\n<li>API Version: v1</li>\n<li>API Endpoint: <code>https://bzr.openai.com</code></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>OpenAI Events API Key</strong>: Required. The Bearer token used to authenticate requests to the OpenAI Events API. This key is sent in the Authorization header as a Bearer token. Your OpenAI account team can provision this value.</li>\n<li><strong>Pixel ID</strong>: Required. Your OpenAI Pixel ID (<code>pid</code>). This value is appended to the API endpoint as a query parameter. Find your Pixel ID in <strong>OpenAI Ads &gt; Settings &gt; Conversions</strong>. Each conversion event you intend to send (for example, <code>page_viewed</code>, <code>items_added</code>, <code>order_created</code>) must be registered there for the pixel before live events count toward reporting.</li>\n<li><strong>Default Action Source</strong>: Select the default source of the conversion event. Defaults to <strong>Web</strong>. Override this per action using the Action Source parameter.</li>\n<li><strong>Base URL Override</strong>: The default is <code>https://bzr.openai.com</code>. Override only if directed by OpenAI for sandbox or staging environments.</li>\n</ul>\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>Send Event (Real-Time)</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✓</td>\n</tr>\n<tr>\n<td>Send Event (Batched)</td>\n<td style=\"text-align:center\">✓</td>\n<td style=\"text-align:center\">✓</td>\n</tr>\n</tbody>\n</table>\n<h3 id=\"send-event-real-time\">Send Event (Real-Time)</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>Event Type</td>\n<td>Required. Select the type of event to send to OpenAI.<br>Supported event types: <strong>Appointment Scheduled</strong>, <strong>Checkout Started</strong>, <strong>Contents Viewed</strong>, <strong>Custom</strong>, <strong>Items Added</strong>, <strong>Lead Created</strong>, <strong>Order Created</strong>, <strong>Page Viewed</strong>, <strong>Registration Completed</strong>, <strong>Subscription Created</strong>, <strong>Trial Started</strong>.</td>\n</tr>\n<tr>\n<td>Custom Event Name</td>\n<td>Required when Event Type is <strong>Custom</strong>. Provide a custom name for the event.<br>This value is ignored for all other event types.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"event-data\">Event Data</h4>\n<p>Map Tealium attributes to OpenAI top-level event fields.</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>Event ID</td>\n<td>Required. A unique identifier for the event, used for deduplication.</td>\n</tr>\n<tr>\n<td>Timestamp</td>\n<td>Required. The event timestamp in milliseconds. Must be within 7 days in the past or 10 minutes in the future.</td>\n</tr>\n<tr>\n<td>OPPRef</td>\n<td>The OpenAI privacy-preserving identifier.</td>\n</tr>\n<tr>\n<td>Source URL</td>\n<td>Required when Action Source is <code>web</code>. The URL of the page where the event occurred.</td>\n</tr>\n<tr>\n<td>Action Source</td>\n<td>The source of the conversion event. Supported values: <code>web</code>, <code>mobile_app</code>, <code>offline</code>, <code>physical_store</code>, <code>phone_call</code>, <code>email</code>, <code>other</code>.</td>\n</tr>\n<tr>\n<td>Opt Out</td>\n<td>Set to <code>true</code> to flag the event as opted out from personalization.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"user-data\">User Data</h4>\n<p>Map applicable user identifiers to improve attribution accuracy. You may either pre-hash PII values yourself or let the connector hash them. Hashable fields appear as two columns: <strong>(apply SHA256 hash)</strong> for raw values the connector normalizes and hashes, and <strong>(already SHA256 hashed)</strong> for pre-hashed values.</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>Email address (apply SHA256 hash)</td>\n<td>Provide a lowercase plain text email address and the connector hashes this value in the format OpenAI expects. Empty or null values are ignored.</td>\n</tr>\n<tr>\n<td>Email address (already SHA256 hashed)</td>\n<td>Provide an email address which has been SHA256 hashed.</td>\n</tr>\n<tr>\n<td>Phone number (apply SHA256 hash)</td>\n<td>Provide a lowercase plain text phone number and the connector hashes this value in the format OpenAI expects. Empty or null values are ignored.</td>\n</tr>\n<tr>\n<td>Phone number (already SHA256 hashed)</td>\n<td>Provide a phone number that has been SHA256 hashed.</td>\n</tr>\n<tr>\n<td>External ID (apply SHA256 hash)</td>\n<td>Provide a plain text external ID, such as a loyalty card ID or another identifier, and the connector hashes this value in the format OpenAI expects.</td>\n</tr>\n<tr>\n<td>External ID (already SHA256 hashed)</td>\n<td>Provide an external ID which has been SHA256 hashed.</td>\n</tr>\n<tr>\n<td>Country (apply SHA256 hash)</td>\n<td>Provide a country associated with the event and the connector hashes this value in the format OpenAI expects.</td>\n</tr>\n<tr>\n<td>Country (already SHA256 hashed)</td>\n<td>Provide a country value which has been SHA256 hashed.</td>\n</tr>\n<tr>\n<td>City (apply SHA256 hash)</td>\n<td>Provide a city associated with the conversion in lowercase letters and the connector hashes this value in the format OpenAI expects.</td>\n</tr>\n<tr>\n<td>City (already SHA256 hashed)</td>\n<td>Provide a city value which has been SHA256 hashed.</td>\n</tr>\n<tr>\n<td>Zip code (apply SHA256 hash)</td>\n<td>Provide a zip or postal code in lowercase and the connector hashes this value in the format OpenAI expects.</td>\n</tr>\n<tr>\n<td>Zip code (already SHA256 hashed)</td>\n<td>Provide a zip or postal code which has been SHA256 hashed.</td>\n</tr>\n<tr>\n<td>External ID (raw)</td>\n<td>A unique ID, such as a loyalty card ID or another identifier. Sent without hashing.</td>\n</tr>\n<tr>\n<td>IP Address</td>\n<td>The IP address of the device.</td>\n</tr>\n<tr>\n<td>User Agent</td>\n<td>The user agent string of the user&rsquo;s web browser.</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"e-commerce\">E-Commerce</h4>\n<p>For Customer Action events (<strong>Appointment Scheduled</strong>, <strong>Lead Created</strong>, <strong>Registration Completed</strong>) only the order-summary fields are accepted. OpenAI drops all other e-commerce fields from the outbound payload.</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>Amount</td>\n<td>An integer in minor units (for example, cents). If provided, Currency is required.</td>\n</tr>\n<tr>\n<td>Currency</td>\n<td>The currency code in ISO 4217 format (for example, <code>USD</code>).</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"disable-automapping\">Disable Automapping</h4>\n<p>When checked, disables the default Tealium-to-OpenAI automappings for this action (timestamp, source URL, IP address, user agent, and retail extension attributes <code>_csubtotal</code>, <code>_ccurrency</code>, <code>_csku</code>, <code>_cprodname</code>, <code>_ccat</code>, <code>_cquan</code>, <code>_cprice</code>). Explicit field mappings always take precedence. Unchecking this only fills in the blanks.</p>\n<h4 id=\"debug-mode\">Debug Mode</h4>\n<p>When enabled, the connector sends the event with <code>validate_only: true</code> so OpenAI validates the payload and returns any errors without persisting the event. Use this for troubleshooting and dry-runs. Leave disabled for production traffic.</p>\n<h4 id=\"pixel-id-override\">Pixel ID Override</h4>\n<p>Optional. Override the connector-level Pixel ID for this action. If provided, the connector uses this value instead of the Pixel ID configured in the connector settings.</p>\n<h4 id=\"api-key-override\">API Key Override</h4>\n<p>Optional. Override the connector-level API Key for this action. If provided, the connector uses this value instead of the API Key configured in the connector settings.</p>\n<h3 id=\"send-event-batched\">Send Event (Batched)</h3>\n<h4 id=\"batch-limits\">Batch limits</h4>\n<p>This action 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: 1,000</li>\n<li>Max time since oldest request: 5 minutes</li>\n<li>Max size of requests: 1 MB</li>\n</ul>\n<p>This action uses the same parameters and mapping options as the <strong>Send Event (Real-Time)</strong> action. For more information, see <a href=\"#send-event-real-time\">Send Event (Real-Time)</a>.</p>\n"
        }  

    ]
}
