Konektor Mixpanel
Hubungkan Mixpanel ke Brevo melalui Tajo untuk menjembatani analitik produk dengan otomatisasi pemasaran. Sinkronkan profil pengguna, event perilaku, dan cohort untuk membuat kampanye berbasis data dari penggunaan produk yang sebenarnya.
Ikhtisar
| Properti | Nilai |
|---|---|
| Platform | Mixpanel |
| Kategori | Analitik (Custom) |
| Kompleksitas setup | Sedang |
| Integrasi resmi | Tidak |
| Data yang disinkronkan | Event, profil, cohort, grup |
| Skill tersedia | 7 |
Fitur
- Ingesti event - Impor event track melalui Ingestion API Mixpanel ke dalam workflow Brevo
- Sinkronisasi profil pengguna - Petakan properti profil pengguna Mixpanel ke atribut kontak Brevo
- Ekspor cohort - Sinkronkan cohort Mixpanel ke list kontak Brevo untuk kampanye tertarget
- Analitik grup - Sinkronkan data tingkat grup untuk pemasaran berbasis akun B2B
- Manajemen identitas - Manfaatkan identity merge Mixpanel untuk profil pelanggan yang terpadu
- Kueri JQL - Jalankan kueri JQL kustom untuk mengekstrak kumpulan data tertentu bagi Brevo
- Lookup table - Sinkronkan data pengayaan dari lookup table Mixpanel
Prasyarat
Sebelum memulai, pastikan Anda memiliki:
- Akun Mixpanel dengan sebuah proyek yang sudah dibuat
- Project Token Mixpanel Anda untuk pelacakan sisi klien
- Service Account dengan izin yang sesuai untuk akses API sisi server
- Akun Brevo dengan akses API
- Akun Tajo dengan kredensial API
Autentikasi
Service Account (direkomendasikan)
Mixpanel menyarankan penggunaan Service Account untuk autentikasi API. Service account memakai HTTP Basic Auth dengan username (username service account) dan password (secret service account).
# Service Account authenticationcurl https://mixpanel.com/api/app/me \ -u "SERVICE_ACCOUNT_USERNAME:SERVICE_ACCOUNT_SECRET"Project Token
Project Token dipakai untuk pelacakan event sisi klien dan aman untuk disertakan dalam kode klien:
// Client-side initializationmixpanel.init("YOUR_PROJECT_TOKEN");OAuth (untuk integrasi partner)
Untuk integrasi aplikasi yang mengakses banyak proyek:
curl https://mixpanel.com/api/2.0/engage \ -H "Authorization: Bearer YOUR_OAUTH_TOKEN"Konfigurasi
Setup dasar
connectors: mixpanel: enabled: true project_token: "your-project-token" service_account: username: "your-service-account-username" secret: "your-service-account-secret" project_id: "12345" data_residency: "US" # or "EU"
# Data sync options sync: events: true profiles: true cohorts: true groups: false
# Brevo list assignment lists: all_users: 15 engaged_users: 16 at_risk: 17Pemetaan event
Petakan event Mixpanel ke tipe event Brevo:
event_mapping: # Mixpanel event -> Brevo event "Purchase": "order_completed" "Sign Up": "customer_created" "Add to Cart": "cart_updated" "Page View": "page_viewed" "$experiment_started": "experiment_started"
# Custom events "Feature Activated": "feature_used" "Subscription Renewed": "subscription_renewed"Pemetaan properti profil
Petakan properti pengguna Mixpanel ke atribut kontak Brevo:
property_mapping: $email: email $first_name: FIRSTNAME $last_name: LASTNAME $phone: SMS $city: CITY $region: REGION $country_code: COUNTRY plan: PLAN_TYPE company: COMPANY signup_date: SIGNUP_DATE total_revenue: LTVEndpoint API
| Metode | Endpoint | Deskripsi |
|---|---|---|
POST | /import | Mengimpor event (Ingestion API) |
POST | /track | Melacak event (sisi klien) |
POST | /engage#$set | Menetapkan properti profil pengguna |
POST | /engage#$set_once | Menetapkan properti hanya jika belum diisi |
POST | /engage#$delete | Menghapus profil pengguna |
POST | /engage#$union | Menggabungkan ke properti berbentuk list |
POST | /groups | Menetapkan properti profil grup |
GET | /export | Mengekspor data event mentah |
POST | /cohorts/list | Menampilkan cohort tersimpan |
POST | /engage/query | Mengkueri profil pengguna |
POST | /jql | Menjalankan kueri JQL kustom |
GET | /segmentation | Mengkueri laporan segmentasi |
GET | /retention | Mengkueri laporan retensi |
GET | /funnels | Mengkueri laporan funnel |
Contoh kode
Inisialisasi konektor Mixpanel
import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({ apiKey: process.env.TAJO_API_KEY, brevoApiKey: process.env.BREVO_API_KEY});
// Connect Mixpanel projectawait tajo.connectors.connect('mixpanel', { projectToken: process.env.MIXPANEL_TOKEN, serviceAccountUser: process.env.MIXPANEL_SA_USER, serviceAccountSecret: process.env.MIXPANEL_SA_SECRET, projectId: process.env.MIXPANEL_PROJECT_ID});Mengimpor event melalui Ingestion API
// Import events to Mixpanel (automatically forwarded to Brevo)const response = await fetch('https://api.mixpanel.com/import', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Basic ' + btoa( `${process.env.MIXPANEL_SA_USER}:${process.env.MIXPANEL_SA_SECRET}` ) }, body: JSON.stringify([ { event: "Purchase", properties: { distinct_id: "user_123", $insert_id: "evt_abc123", time: Math.floor(Date.now() / 1000), revenue: 89.99, product_id: "SKU-001", product_name: "Widget Pro" } } ])});
// Expected response: { "code": 200, "status": "OK", "num_records_imported": 1 }Menyinkronkan cohort ke Brevo
// Export a Mixpanel cohort and sync to a Brevo listconst cohort = await tajo.connectors.syncCohort('mixpanel', { cohortId: 12345, targetList: 16, syncMode: 'mirror'});
console.log(cohort);// {// cohortName: "Engaged Users (Last 7 Days)",// membersCount: 3200,// syncedToBrevo: 3200,// listId: 16// }Menetapkan properti profil pengguna
// Set user properties via the Engage APIconst response = await fetch('https://api.mixpanel.com/engage#$set', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify([{ $token: process.env.MIXPANEL_TOKEN, $distinct_id: "user_123", $set: { $first_name: "Jane", $last_name: "Kim", plan: "premium", total_orders: 12, lifetime_value: 1250.00 } }])});Batas rate
| API | Batas | Detail |
|---|---|---|
| Ingestion API | 2 GB/menit | Per proyek |
| Track API | Tanpa batas keras | Pengiriman best-effort |
| Engage API | 2.000 pembaruan/batch | Maksimum 2 GB/menit per proyek |
| Query API | 60 permintaan/jam | Per proyek (Service Account) |
| Export API | 60 permintaan/jam | Maksimum 100 hari per kueri |
| JQL API | 60 permintaan/jam | Per proyek |
| Ekspor cohort | 60 permintaan/jam | Per proyek |
Deduplikasi event
Mixpanel melakukan deduplikasi event menggunakan properti $insert_id. Selalu sertakan $insert_id yang unik untuk mencegah event ganda saat mengulang impor yang gagal.
Pemecahan masalah
| Masalah | Penyebab | Solusi |
|---|---|---|
| Event tidak muncul | Project token salah | Pastikan token cocok dengan proyek tujuan |
| Properti profil hilang | Menggunakan API yang salah | Gunakan /engage#$set untuk properti profil, bukan /track |
| Ekspor cohort gagal | Izin tidak mencukupi | Pastikan Service Account memiliki peran Admin atau Analyst |
| Event ganda | $insert_id tidak ada | Sertakan $insert_id unik pada setiap event |
| 402 Payment Required | Melebihi batas data | Periksa batas paket Mixpanel dan tingkatkan bila perlu |
| Data EU tidak dirutekan | Data residency salah | Gunakan api-eu.mixpanel.com untuk proyek EU |
| Masalah identity merge | distinct_id keliru | Ikuti praktik terbaik manajemen identitas Mixpanel |
Praktik terbaik
- Gunakan Service Account - Utamakan Service Account dibanding Project Secret untuk autentikasi sisi server
- Sertakan
$insert_id- Selalu tetapkan insert ID unik untuk deduplikasi event - Kelompokkan pembaruan profil - Kirim hingga 2.000 pembaruan profil per permintaan agar efisien
- Gunakan endpoint EU - Untuk data residency EU, pakai
api-eu.mixpanel.compada seluruh panggilan API - Sinkronkan cohort terjadwal - Siapkan sinkronisasi cohort harian atau mingguan alih-alih polling terus-menerus
- Petakan properti bawaan - Gunakan properti bawaan Mixpanel (
$email,$first_name) untuk data profil - Pantau ingesti - Gunakan halaman Events Mixpanel untuk memastikan event diterima dengan benar
Keamanan
- Hanya HTTPS - Seluruh komunikasi API mensyaratkan enkripsi TLS
- Isolasi Service Account - Akses dibatasi per proyek dengan izin berbasis peran
- Deduplikasi event - Dedup bawaan via
$insert_idmencegah masalah integritas data - SOC 2 Type II - Mixpanel bersertifikat SOC 2 Type II
- GDPR/CCPA - Mendukung penghapusan data pengguna melalui GDPR API
- Data residency EU - Pusat data EU tersedia untuk kepatuhan Eropa