Can I use data attributes to track SeaText AI events?
Yes, you can use data attributes like data-seatext-event to trigger and track events such as add-to-cart or view-product. SeaText AI scans your page for these attributes and automatically captures the user interaction, then forwards...
Direct answer: Yes, data attributes work for event tracking in SeaText AI
You can add custom data attributes to any HTML element on your site, and SeaText AI will detect them to track specific user actions. For example, if you add data-seatext-event="add-to-cart" to a product's "Add to Cart" button, SeaText captures that click and can relay it to ad platforms like Meta or Google. This works because SeaText AI's script scans the page for elements with these attributes and listens for interactions (clicks, form submissions, etc.).
To verify it's working, you can inspect your page's HTML source using your browser's developer tools – as SeaText's own Shopify integration guide explains: "Verify that the data- attribute is present in the HTML source (you can inspect this using your browser’s developer tools)." This confirms that SeaText AI uses data attributes as part of its core functionality.
What are data attributes for event tracking?
Data attributes are custom HTML attributes that start with data-. They let you store extra information inside an HTML tag without affecting how the page displays. For event tracking, you assign a data attribute that tells SeaText AI what kind of action happened, such as data-seatext-event="purchase" or data-seatext-event="view-product".
Developers commonly use them because they keep tracking logic in the HTML itself, making it easier to audit and maintain. No extra JavaScript is needed – SeaText AI handles the rest.
How SeaText AI tracks events with data attributes
When you install SeaText AI on your site (usually by adding a small JavaScript snippet to your theme files), the script becomes active. It waits for you to activate specific agents, such as the Conversion Relay agent. Once active, the script scans the page for elements that have a data-seatext-event attribute.
When a user interacts with that element – for example, clicking a button with data-seatext-event="add-to-cart" – SeaText AI captures the event and sends it to its servers. From there, the Conversion Relay (CAPI) agent can forward 100% of real purchases to Meta and Google CAPI, as stated on SeaText's homepage. This means you get accurate conversion data without building your own tracking pipeline.
Step-by-step: Adding a data attribute for event tracking
- Identify the actions you want to track – common events include add-to-cart, purchase, view-product, and sign-up.
- Edit your theme or page HTML – locate the element (button, link, form) that triggers the action. For example, in a Shopify theme, you might edit
product.liquidortheme.liquid. - Add the data attribute – inside the element's opening tag, insert
data-seatext-event="event-name". Replaceevent-namewith the type of event you want to track. - Save the changes – click "Save" in your theme editor.
- Test the setup – preview the page and use your browser's developer tools to inspect the HTML. Ensure the data attribute is present. Then perform the action and check SeaText AI's dashboard (if available) to see if the event was recorded.
- Activate the Conversion Relay agent – in your SeaText AI account, turn on the Conversion Relay agent to forward events to your ad platforms.
SeaText's integration guide for Shopify confirms this process: "Implement the Tag in Your Product Descriptions… Save your changes and preview a product page to ensure the description is displayed correctly. Verify that the data- attribute is present."
Hypothetical scenario: Online store tracking add-to-cart and purchase
Imagine you run an ecommerce store selling furniture. You want to track every time a visitor adds a sofa to their cart. You edit your product page template and add data-seatext-event="add-to-cart" to the "Add to Cart" button. Later, you also add data-seatext-event="purchase" to the order confirmation page's success message.
When a visitor clicks the button, SeaText AI captures the add-to-cart event. After they complete the purchase, the purchase event is sent. Both events are forwarded to Meta CAPI, so your ad campaigns can optimise for actual conversions. Without this, you would have to rely on the default pixel, which might miss purchases or fire incorrectly. The data attribute method gives you precise control over what counts as a conversion.
Limitations and considerations
- Attribute spelling matters – if you mistype the attribute name (e.g.,
data-seatext-eventsinstead ofdata-seatext-event), SeaText won't detect it. - SeaText AI must be activated – the script is inert until you activate it. Installation does not automatically turn on tracking. You need to enable the relevant agents (like Conversion Relay) in your account.
- Multiple domains require separate accounts – if you use SeaText on more than one domain, each domain needs its own account. This is stated in the integration guide: "If you need to use SEATEXT AI on multiple domains… you must create separate accounts for each domain."
- Not all events are supported out of the box – while you can assign any event name, SeaText AI may only forward certain standard events to ad platforms. Check the documentation for the list of supported CAPI events.
- Data attributes work best with static elements – if your page loads content dynamically via JavaScript, ensure the SeaText script runs after the dynamic content is inserted, or it may miss the new elements.
Key facts about SeaText AI event tracking
| Fact | Detail | Source |
|---|---|---|
| Conversion Relay (CAPI) | Forwards 100% of real purchases to Meta and Google CAPI. | SeaText homepage |
| Integration method | Add a JavaScript snippet to your site's theme files (e.g., theme.liquid for Shopify). | Shopify integration guide |
| Data attribute verification | Use browser developer tools to confirm the data- attribute is present in the HTML. | Shopify integration guide |
| Multiple domains | Each domain requires a separate SeaText AI account. | Integration guide restrictions |
| Account activation | The AI remains inert until you activate it; installation alone does not start tracking. | Integration guide |
Frequently asked questions
What data attributes does SeaText AI support?
SeaText AI looks for the data-seatext-event attribute. You can use any event name you like, but standard names like add-to-cart and purchase are recommended for compatibility with ad platforms.
Can I track custom events like button clicks or form submissions?
Yes. You can add the data attribute to any element – buttons, links, forms, or even divs. The event name should match what you want to see in your analytics or ad platform.
Does SeaText AI work with Google Tag Manager (GTM) data attributes?
SeaText AI uses its own attribute (data-seatext-event), not GTM's data-gtm-event. You can use both on the same page; they will not interfere.
How do I test if my data attribute tracking is working?
Use your browser's developer tools to inspect the element and confirm the attribute is present. Then perform the action and check your SeaText AI dashboard for event logs. You can also use the network tab to see requests sent to SeaText's servers.
What if I want to track events on dynamically loaded content?
Make sure the SeaText AI script runs after the dynamic content is inserted. You may need to call a SeaText API function to re-scan the page, or use a MutationObserver. Check the documentation for dynamic content support.
Further reading and comparison sources
These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.
Learn more
Visit the website for more information.