{"componentChunkName":"component---src-templates-markdown-template-jsx","path":"/guides/data-warehouse/composable-audiences/data-models/event-data-models/","result":{"data":{"pageMetadata":{"title":"Create an Event Data Model","path":"/guides/data-warehouse/composable-audiences/data-models/event-data-models/","sourceCode":null,"metadataParent":{"title":"Data Models","path":"/guides/data-warehouse/composable-audiences/data-models/","sourceCode":null,"hasVersionPicker":null,"metadataChildren":[{"title":"Data Models Overview","path":"/guides/data-warehouse/composable-audiences/data-models/overview/","order":1,"label":null},{"title":"Create a User Data Model","path":"/guides/data-warehouse/composable-audiences/data-models/user-data-models/","order":2,"label":null},{"title":"Create an Event Data Model","path":"/guides/data-warehouse/composable-audiences/data-models/event-data-models/","order":3,"label":null},{"title":"Create a Generic Data Model","path":"/guides/data-warehouse/composable-audiences/data-models/generic-data-models/","order":4,"label":null}],"metadataParent":{"title":"Composable Audiences","path":"/guides/data-warehouse/composable-audiences/","metadataChildren":[{"title":"Warehouse Setup Overview","path":"/guides/data-warehouse/composable-audiences/overview/","order":0.5,"label":null},{"title":"Connections","path":"/guides/data-warehouse/composable-audiences/connections/","order":1,"label":null},{"title":"Data Models","path":"/guides/data-warehouse/composable-audiences/data-models/","order":2,"label":null}],"metadataParent":{"title":"Data Warehouse","path":"/guides/data-warehouse/","metadataChildren":[{"title":"Composable Audiences","path":"/guides/data-warehouse/composable-audiences/","order":1,"label":null},{"title":"Warehouse Sync","path":"/guides/data-warehouse/warehouse-sync/","order":4,"label":null}],"metadataParent":{"title":"Guides","path":"/guides/","metadataChildren":[{"title":"Platform Overview","path":"/guides/platform-overview/","order":0.5,"label":null},{"title":"Getting Started","path":"/guides/getting-started/","order":1,"label":null},{"title":"mParticle Agent","path":"/guides/mparticle-agent/","order":1.5,"label":null},{"title":"Oversight","path":"/guides/oversight/","order":2,"label":null},{"title":"Data Platform","path":"/guides/data-platform/","order":3,"label":null},{"title":"Data Warehouse","path":"/guides/data-warehouse/","order":4,"label":null},{"title":"Customer 360","path":"/guides/customer-360/","order":5,"label":null},{"title":"Analytics","path":"/guides/analytics/","order":6,"label":null},{"title":"Audiences","path":"/guides/audiences/","order":7,"label":null},{"title":"Settings","path":"/guides/settings/","order":8,"label":null},{"title":"Troubleshooting mParticle","path":"/guides/troubleshooting/","order":10,"label":null},{"title":"Default Service Limits","path":"/guides/default-service-limits/","order":11,"label":null},{"title":"Glossary","path":"/guides/glossary/","order":12,"label":null}],"metadataParent":null}}}}},"markdownRemark":{"html":"<p><strong>Event Data Models</strong> capture timestamped user actions (such as logins, purchases, or conversions) that can be used to refine or enrich your audience definitions. These models pull event-level data from your cloud data warehouse and link back to a User Data Model using a shared identifier (for example, <code class=\"language-text\">user_id</code>).</p>\n<p>This makes it possible to build audiences not just on who your users are, but also on what they do. For example, you might want to create an audience of users who made more than three purchases in the past 90 days, or subscribers who logged in fewer than two times last month.</p>\n<h2 id=\"example\" style=\"position:relative;\"><a href=\"#example\" aria-label=\"example permalink\" class=\"anchor before\"><svg width=\"16px\" height=\"17px\" viewBox=\"0 0 16 17\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n                <g id=\"Symbols\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n                    <g id=\"Icon/Link\" fill=\"#98A0A3\" fill-rule=\"nonzero\">\n                        <g id=\"link\">\n                            <path d=\"M9.5,12.4 C9.6,12.4 9.7,12.4 9.9,12.4 C9.8,12.5 9.8,12.5 9.7,12.6 L7.5,14.8 C5.8,16.5 3,16.5 1.3,14.8 C-0.4,13.1 -0.4,10.3 1.3,8.6 L3.5,6.4 C3.6,6.3 3.6,6.3 3.7,6.2 C5,5 6.9,4.8 8.4,5.5 C8.8,5.7 9.3,6 9.6,6.4 C10,6.7 10.2,7.2 10.5,7.6 C10.2,7.9 9.9,8 9.5,8 C9.4,8 9.2,8 9.1,7.9 C8.9,7.5 8.5,7.2 8.1,6.9 C7,6.2 5.5,6.4 4.5,7.3 L3.8,8 L2.3,9.5 C1.2,10.6 1.2,12.5 2.3,13.6 C3.4,14.7 5.3,14.7 6.4,13.6 L7.9,12.1 C8.4,12.3 8.9,12.4 9.5,12.4 Z M14.7,1.3 C13,-0.4 10.2,-0.4 8.5,1.3 L6.3,3.5 C6.2,3.6 6.2,3.6 6.1,3.7 C6.7,3.7 7.4,3.7 8,3.9 L9.5,2.4 C10.6,1.3 12.5,1.3 13.6,2.4 C14.7,3.5 14.7,5.4 13.6,6.5 L12.1,8 L11.4,8.7 C10.4,9.7 8.9,9.8 7.8,9.1 C7.4,8.9 7.1,8.5 6.8,8.1 C6.7,8.1 6.5,8 6.4,8 C6,8 5.6,8.2 5.4,8.4 C5.6,8.8 5.9,9.3 6.3,9.6 C6.6,10 7.1,10.2 7.5,10.5 C9,11.2 10.9,11 12.3,9.8 C12.4,9.7 12.4,9.7 12.5,9.6 L14.7,7.4 C16.4,5.7 16.4,3 14.7,1.3 Z\" id=\"Shape\"></path>\n                        </g>\n                    </g>\n                </g>\n            </svg></a>Example</h2>\n<p>Here is a simple SQL query you might use to define an event data model for purchases:</p>\n<div class=\"gatsby-highlight\" data-language=\"sql\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-sql line-numbers\"><code class=\"language-sql\"><span class=\"token keyword\">SELECT</span>\n  user_id<span class=\"token punctuation\">,</span>\n  order_id <span class=\"token keyword\">AS</span> event_id<span class=\"token punctuation\">,</span>\n  purchase_date <span class=\"token keyword\">AS</span> event_time<span class=\"token punctuation\">,</span>\n  total_value\n<span class=\"token keyword\">FROM</span> ecommerce<span class=\"token punctuation\">.</span>orders</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<ul>\n<li><code class=\"language-text\">order_id</code> is the <strong>primary ID</strong> for each event (each purchase is unique).</li>\n<li><code class=\"language-text\">purchase_date</code> is the <strong>timestamp</strong> that tells mParticle when the event occurred.</li>\n<li><code class=\"language-text\">user_id</code> is the <strong>user identifier</strong> that links this purchase back to a specific customer in your User model.</li>\n</ul>\n<p>With this model in place, you could build an audience such as <em>“Gold loyalty tier users who made more than 3 purchases in the last 90 days.”</em></p>\n<p>This example focuses on <strong>what the user does</strong>. When combined with a User Data Model (who the user is) and a Generic Data Model (extra context), you can build more precise and meaningful segments.</p>\n<aside class=\"warning\">\nIf a column referenced in your SQL query is renamed or dropped in your warehouse, the model (and any audiences depending on it) will break. Work with your data team to coordinate schema changes.\n</aside>\n<h2 id=\"to-create-an-event-data-model\" style=\"position:relative;\"><a href=\"#to-create-an-event-data-model\" aria-label=\"to create an event data model permalink\" class=\"anchor before\"><svg width=\"16px\" height=\"17px\" viewBox=\"0 0 16 17\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n                <g id=\"Symbols\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n                    <g id=\"Icon/Link\" fill=\"#98A0A3\" fill-rule=\"nonzero\">\n                        <g id=\"link\">\n                            <path d=\"M9.5,12.4 C9.6,12.4 9.7,12.4 9.9,12.4 C9.8,12.5 9.8,12.5 9.7,12.6 L7.5,14.8 C5.8,16.5 3,16.5 1.3,14.8 C-0.4,13.1 -0.4,10.3 1.3,8.6 L3.5,6.4 C3.6,6.3 3.6,6.3 3.7,6.2 C5,5 6.9,4.8 8.4,5.5 C8.8,5.7 9.3,6 9.6,6.4 C10,6.7 10.2,7.2 10.5,7.6 C10.2,7.9 9.9,8 9.5,8 C9.4,8 9.2,8 9.1,7.9 C8.9,7.5 8.5,7.2 8.1,6.9 C7,6.2 5.5,6.4 4.5,7.3 L3.8,8 L2.3,9.5 C1.2,10.6 1.2,12.5 2.3,13.6 C3.4,14.7 5.3,14.7 6.4,13.6 L7.9,12.1 C8.4,12.3 8.9,12.4 9.5,12.4 Z M14.7,1.3 C13,-0.4 10.2,-0.4 8.5,1.3 L6.3,3.5 C6.2,3.6 6.2,3.6 6.1,3.7 C6.7,3.7 7.4,3.7 8,3.9 L9.5,2.4 C10.6,1.3 12.5,1.3 13.6,2.4 C14.7,3.5 14.7,5.4 13.6,6.5 L12.1,8 L11.4,8.7 C10.4,9.7 8.9,9.8 7.8,9.1 C7.4,8.9 7.1,8.5 6.8,8.1 C6.7,8.1 6.5,8 6.4,8 C6,8 5.6,8.2 5.4,8.4 C5.6,8.8 5.9,9.3 6.3,9.6 C6.6,10 7.1,10.2 7.5,10.5 C9,11.2 10.9,11 12.3,9.8 C12.4,9.7 12.4,9.7 12.5,9.6 L14.7,7.4 C16.4,5.7 16.4,3 14.7,1.3 Z\" id=\"Shape\"></path>\n                        </g>\n                    </g>\n                </g>\n            </svg></a>To create an event data model</h2>\n<h3 id=\"1-enter-your-query\" style=\"position:relative;\"><a href=\"#1-enter-your-query\" aria-label=\"1 enter your query permalink\" class=\"anchor before\"><svg width=\"16px\" height=\"17px\" viewBox=\"0 0 16 17\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n                <g id=\"Symbols\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n                    <g id=\"Icon/Link\" fill=\"#98A0A3\" fill-rule=\"nonzero\">\n                        <g id=\"link\">\n                            <path d=\"M9.5,12.4 C9.6,12.4 9.7,12.4 9.9,12.4 C9.8,12.5 9.8,12.5 9.7,12.6 L7.5,14.8 C5.8,16.5 3,16.5 1.3,14.8 C-0.4,13.1 -0.4,10.3 1.3,8.6 L3.5,6.4 C3.6,6.3 3.6,6.3 3.7,6.2 C5,5 6.9,4.8 8.4,5.5 C8.8,5.7 9.3,6 9.6,6.4 C10,6.7 10.2,7.2 10.5,7.6 C10.2,7.9 9.9,8 9.5,8 C9.4,8 9.2,8 9.1,7.9 C8.9,7.5 8.5,7.2 8.1,6.9 C7,6.2 5.5,6.4 4.5,7.3 L3.8,8 L2.3,9.5 C1.2,10.6 1.2,12.5 2.3,13.6 C3.4,14.7 5.3,14.7 6.4,13.6 L7.9,12.1 C8.4,12.3 8.9,12.4 9.5,12.4 Z M14.7,1.3 C13,-0.4 10.2,-0.4 8.5,1.3 L6.3,3.5 C6.2,3.6 6.2,3.6 6.1,3.7 C6.7,3.7 7.4,3.7 8,3.9 L9.5,2.4 C10.6,1.3 12.5,1.3 13.6,2.4 C14.7,3.5 14.7,5.4 13.6,6.5 L12.1,8 L11.4,8.7 C10.4,9.7 8.9,9.8 7.8,9.1 C7.4,8.9 7.1,8.5 6.8,8.1 C6.7,8.1 6.5,8 6.4,8 C6,8 5.6,8.2 5.4,8.4 C5.6,8.8 5.9,9.3 6.3,9.6 C6.6,10 7.1,10.2 7.5,10.5 C9,11.2 10.9,11 12.3,9.8 C12.4,9.7 12.4,9.7 12.5,9.6 L14.7,7.4 C16.4,5.7 16.4,3 14.7,1.3 Z\" id=\"Shape\"></path>\n                        </g>\n                    </g>\n                </g>\n            </svg></a>1. Enter your query</h3>\n<ol>\n<li>Navigate to <strong>Data Warehouse > Data Models</strong>.</li>\n<li>Click <strong>+ Add Data Model</strong>.</li>\n<li>Select <strong>Event Data Model</strong>.</li>\n<li>Select a warehouse connection using the <strong>Data Connection</strong> dropdown menu.</li>\n<li>Under <strong>SQL Query</strong>, enter the SQL query you want to execute against your warehouse. Your query should return timestamped actions associated with user identifiers.</li>\n<li>Click <strong>Run Query</strong>.</li>\n<li>Click <strong>Next Step</strong> to continue.</li>\n</ol>\n<p><img src=\"/images/guides/composable-audiences/data-models-create-event-model-1.png\"></p>\n<aside class=\"warning\">\nEvent data models always require a <b>timestamp</b> and a <b>user identifier</b>. Without these, you cannot use the model for audience building.\n</aside>\n<h3 id=\"2-enter-your-configuration-details\" style=\"position:relative;\"><a href=\"#2-enter-your-configuration-details\" aria-label=\"2 enter your configuration details permalink\" class=\"anchor before\"><svg width=\"16px\" height=\"17px\" viewBox=\"0 0 16 17\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n                <g id=\"Symbols\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n                    <g id=\"Icon/Link\" fill=\"#98A0A3\" fill-rule=\"nonzero\">\n                        <g id=\"link\">\n                            <path d=\"M9.5,12.4 C9.6,12.4 9.7,12.4 9.9,12.4 C9.8,12.5 9.8,12.5 9.7,12.6 L7.5,14.8 C5.8,16.5 3,16.5 1.3,14.8 C-0.4,13.1 -0.4,10.3 1.3,8.6 L3.5,6.4 C3.6,6.3 3.6,6.3 3.7,6.2 C5,5 6.9,4.8 8.4,5.5 C8.8,5.7 9.3,6 9.6,6.4 C10,6.7 10.2,7.2 10.5,7.6 C10.2,7.9 9.9,8 9.5,8 C9.4,8 9.2,8 9.1,7.9 C8.9,7.5 8.5,7.2 8.1,6.9 C7,6.2 5.5,6.4 4.5,7.3 L3.8,8 L2.3,9.5 C1.2,10.6 1.2,12.5 2.3,13.6 C3.4,14.7 5.3,14.7 6.4,13.6 L7.9,12.1 C8.4,12.3 8.9,12.4 9.5,12.4 Z M14.7,1.3 C13,-0.4 10.2,-0.4 8.5,1.3 L6.3,3.5 C6.2,3.6 6.2,3.6 6.1,3.7 C6.7,3.7 7.4,3.7 8,3.9 L9.5,2.4 C10.6,1.3 12.5,1.3 13.6,2.4 C14.7,3.5 14.7,5.4 13.6,6.5 L12.1,8 L11.4,8.7 C10.4,9.7 8.9,9.8 7.8,9.1 C7.4,8.9 7.1,8.5 6.8,8.1 C6.7,8.1 6.5,8 6.4,8 C6,8 5.6,8.2 5.4,8.4 C5.6,8.8 5.9,9.3 6.3,9.6 C6.6,10 7.1,10.2 7.5,10.5 C9,11.2 10.9,11 12.3,9.8 C12.4,9.7 12.4,9.7 12.5,9.6 L14.7,7.4 C16.4,5.7 16.4,3 14.7,1.3 Z\" id=\"Shape\"></path>\n                        </g>\n                    </g>\n                </g>\n            </svg></a>2. Enter your configuration details</h3>\n<ol>\n<li>Enter a descriptive name for your data model.</li>\n<li>Select a <strong>primary ID column</strong> (such as <code class=\"language-text\">event_id</code>) retrieved from your SQL query to uniquely identify each event.</li>\n</ol>\n<p><img src=\"/images/guides/composable-audiences/data-models-create-event-model-2.png\"></p>\n<aside>\nYour primary ID column must be unique per row and have a datatype of string or number.\n</aside>\n<ol start=\"3\">\n<li>Select a <strong>timestamp column</strong> that represents when the event occurred.</li>\n<li>Include a <strong>user identifier</strong> (such as <code class=\"language-text\">user_id</code>) to denote who performed the event.</li>\n<li>Click <strong>Save Data Model</strong> to continue.</li>\n</ol>\n<h3 id=\"3-enter-your-column-settings-optional\" style=\"position:relative;\"><a href=\"#3-enter-your-column-settings-optional\" aria-label=\"3 enter your column settings optional permalink\" class=\"anchor before\"><svg width=\"16px\" height=\"17px\" viewBox=\"0 0 16 17\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n                <g id=\"Symbols\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n                    <g id=\"Icon/Link\" fill=\"#98A0A3\" fill-rule=\"nonzero\">\n                        <g id=\"link\">\n                            <path d=\"M9.5,12.4 C9.6,12.4 9.7,12.4 9.9,12.4 C9.8,12.5 9.8,12.5 9.7,12.6 L7.5,14.8 C5.8,16.5 3,16.5 1.3,14.8 C-0.4,13.1 -0.4,10.3 1.3,8.6 L3.5,6.4 C3.6,6.3 3.6,6.3 3.7,6.2 C5,5 6.9,4.8 8.4,5.5 C8.8,5.7 9.3,6 9.6,6.4 C10,6.7 10.2,7.2 10.5,7.6 C10.2,7.9 9.9,8 9.5,8 C9.4,8 9.2,8 9.1,7.9 C8.9,7.5 8.5,7.2 8.1,6.9 C7,6.2 5.5,6.4 4.5,7.3 L3.8,8 L2.3,9.5 C1.2,10.6 1.2,12.5 2.3,13.6 C3.4,14.7 5.3,14.7 6.4,13.6 L7.9,12.1 C8.4,12.3 8.9,12.4 9.5,12.4 Z M14.7,1.3 C13,-0.4 10.2,-0.4 8.5,1.3 L6.3,3.5 C6.2,3.6 6.2,3.6 6.1,3.7 C6.7,3.7 7.4,3.7 8,3.9 L9.5,2.4 C10.6,1.3 12.5,1.3 13.6,2.4 C14.7,3.5 14.7,5.4 13.6,6.5 L12.1,8 L11.4,8.7 C10.4,9.7 8.9,9.8 7.8,9.1 C7.4,8.9 7.1,8.5 6.8,8.1 C6.7,8.1 6.5,8 6.4,8 C6,8 5.6,8.2 5.4,8.4 C5.6,8.8 5.9,9.3 6.3,9.6 C6.6,10 7.1,10.2 7.5,10.5 C9,11.2 10.9,11 12.3,9.8 C12.4,9.7 12.4,9.7 12.5,9.6 L14.7,7.4 C16.4,5.7 16.4,3 14.7,1.3 Z\" id=\"Shape\"></path>\n                        </g>\n                    </g>\n                </g>\n            </svg></a>3. Enter your column settings (optional)</h3>\n<ol>\n<li>Use the <strong>Enabled</strong> toggle to disable or re-enable a column.</li>\n<li>Review the <strong>data type</strong> mParticle detects for each column. Update if needed.</li>\n<li>Enable <strong>Autocomplete</strong> to see cached values for up to 7 days when building audiences.</li>\n<li>Use the <strong>Is Case Sensitive (Yes/No)</strong> setting to control casing for autocomplete.</li>\n</ol>\n<p><img src=\"/images/guides/composable-audiences/data-models-create-event-model-3.png\"></p>\n<p>Click <strong>Save Data Model</strong> to continue.</p>\n<aside>\nYou must link your event data model to a user data model before it can be used in audience definitions. This relationship allows event data to be associated with specific users.\n</aside>","frontmatter":{"title":"Create an Event Data Model","order":3,"seoTitle":null,"seoDescription":null},"parent":{"__typename":"File","modifiedTime":"October 12, 2026"}}},"pageContext":{"slug":"/guides/data-warehouse/composable-audiences/data-models/event-data-models/"}},"staticQueryHashes":["2950460867"]}