Can I use web SDK to scan data in table format and send them as events from backend when a certain trigger happens on the web?
Hi Alaa I., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đ
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
I'm sorry, but there's no information about using the Mixpanel Web (JavaScript) SDK to scan backend tables. The knowledge sources indicate that the Web SDK and backend tracking serve different purposes and have different capabilities.Based on the provided documentation, here is how you can achieve your goal using the appropriate methods:
1. Web SDK vs. Backend Tracking
The Mixpanel JavaScript SDK is a client-side tool designed to track user interactions that happen directly in the browser, such as button clicks or page views [Choosing the Right Method; Sending Events (JS)]. It does not have the capability to scan or query backend database tables.
2. Scanning Tables and Sending Events from the Backend
If you want to send data stored in a table format from your backend when a trigger occurs, you should use a Server-Side SDK (such as Node.js, Python, or Java) or Warehouse Connectors: ** Server-Side SDKs: Your backend logic can "scan" your database and then use a Mixpanel server SDK to send that data as events. For example, using the Node.js SDK, you would use the track() method to send the table data as event properties [Sending Events (Node.js)].
** Warehouse Connectors: If your data is in a supported data warehouse (like BigQuery or Snowflake), you can sync those tables directly to Mixpanel as events without writing custom code. Any row with a timestamp and a user ID can be treated as an event [Warehouse Connectors; Evolving Our Data Model].
3. Recommended Hybrid Approach
The best practice is a hybrid approach: ** Use the Web SDK to capture the "trigger" event on the web (e.g., a user clicking a button) [Frequently Asked Questions]. ** Use your Backend/Server-Side logic to listen for that trigger, retrieve the necessary data from your tables, and then send it to Mixpanel using a server-side SDK or the Ingestion API [Choosing the Right Method; Import Events API].
kapa.ai is still learning and improving, please let me know how I did by reacting below.
âšī¸Â Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! đ
Yes, if your table is updated with new data, Mixpanel can automatically reflect those changes using Warehouse Connectors. The behavior depends on which Sync Mode you choose:
Mirror Mode (Recommended)
Mirror is specifically designed to keep Mixpanel in "lockstep" with your warehouse. It uses Change Data Capture (CDC) to detect any modifications in your source table.
** Updates: If you change a property value in an existing row (e.g., updating a payment_status from "pending" to "completed"), Mirror will update that event in Mixpanel [Mirror Mode Demo; Eliminate Tracking Workarounds].
** Deletes: If a row is deleted from your warehouse, it will be removed from Mixpanel [Sync Modes].
** *New Data: Any new rows added to the table are automatically ingested during the next sync [Mirror Mode Demo].
Append Mode
Append is more restrictive and is primarily used for tables where data is only added, never changed.
** New Data: It will successfully load new rows based on an insert_time column [Append Mode].
** Updates/Deletes: It ignores any modifications or deletions to existing rows. If you update a row that was already synced, Mixpanel will not see that update [Sync Modes].
Billing Note
Updates and deletions performed via Mirror mode are counted as billable events. Specifically, updating a property value or adding a new non-NULL property to an existing row counts as a billable action for each affected row in the sync [Warehouse Connector Billing].Mirror mode is currently supported for Snowflake, BigQuery, Databricks, and Redshift [Sync Modes].
kapa.ai is still learning and improving, please let me know how I did by reacting below.
âšī¸Â Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
