Optimizely कनेक्टर
experiment results sync करने, feature flag segments द्वारा campaigns को target करने, और A/B test data एवं audience insights के साथ marketing automations को समृद्ध करने के लिए Tajo के माध्यम से Optimizely Feature Experimentation को Brevo से कनेक्ट करें।
अवलोकन
| Property | Value |
|---|---|
| Platform | Optimizely |
| Category | Experimentation (Custom) |
| Setup Complexity | Medium |
| Official Integration | No |
| Data Synced | Experiments, Audiences, Events, Feature Flags |
| Auth Method | Personal Access Token / OAuth 2.0 |
विशेषताएं
- Experiment sync - A/B test variation assignments को Brevo contact attributes में push करें
- Audience targeting - Brevo campaign segmentation के लिए Optimizely audiences का उपयोग करें
- Conversion tracking - Optimizely events को ट्रैक करें और Brevo event tracking से map करें
- Feature flag sync - enabled feature flags द्वारा contacts segment करें
- Results reporting - post-analysis marketing campaigns के लिए experiment results sync करें
- Multi-project support - एक single Tajo instance से कई Optimizely projects कनेक्ट करें
पूर्वावश्यकताएं
शुरू करने से पहले, सुनिश्चित करें कि आपके पास हैं:
- एक Optimizely Feature Experimentation account
- Optimizely App Settings से एक Personal Access Token
- आपके Optimizely environment के लिए एक SDK key
- API access वाला एक Brevo account
- connector permissions वाला एक Tajo account
प्रमाणीकरण
Personal Access Token
# https://app.optimizely.com/v2/accountsettings/tokens पर generate करेंexport OPTIMIZELY_ACCESS_TOKEN=your_personal_access_tokenexport OPTIMIZELY_SDK_KEY=your_sdk_keyexport TAJO_API_KEY=your_tajo_api_keyexport BREVO_API_KEY=your_brevo_api_key// सभी REST API requests Bearer token auth का उपयोग करते हैंconst headers = { 'Authorization': `Bearer ${process.env.OPTIMIZELY_ACCESS_TOKEN}`, 'Content-Type': 'application/json'};SDK Authentication
// feature flag evaluation के लिए, SDK का उपयोग करेंconst optimizelySDK = require('@optimizely/optimizely-sdk');
const optimizelyClient = optimizelySDK.createInstance({ sdkKey: process.env.OPTIMIZELY_SDK_KEY, datafileOptions: { autoUpdate: true, updateInterval: 60000 // 1 minute }});
await optimizelyClient.onReady();कॉन्फ़िगरेशन
बेसिक सेटअप
connectors: optimizely: enabled: true access_token: "${OPTIMIZELY_ACCESS_TOKEN}" sdk_key: "${OPTIMIZELY_SDK_KEY}" project_id: "12345678"
sync: experiments: true audiences: true events: true feature_flags: true schedule: "0 */2 * * *" # हर 2 घंटे में
mapping: experiment_variation: EXPERIMENT_VARIATION feature_flags: ENABLED_FEATURES audience_segments: OPT_SEGMENTSField Mapping
field_mapping: user_id: email experiment_key: EXPERIMENT_NAME variation_key: VARIATION_NAME feature_key: FEATURE_FLAG enabled: FEATURE_ENABLED audience_name: AUDIENCE_SEGMENT decision_timestamp: EXPERIMENT_DATEAPI Endpoints
| Endpoint | Method | विवरण |
|---|---|---|
https://api.optimizely.com/v2/projects | GET | projects list करें |
https://api.optimizely.com/v2/experiments | GET | experiments list करें |
https://api.optimizely.com/v2/experiments/{id} | GET | experiment विवरण प्राप्त करें |
https://api.optimizely.com/v2/experiments/{id}/results | GET | experiment results प्राप्त करें |
https://api.optimizely.com/v2/features | GET | feature flags list करें |
https://api.optimizely.com/v2/features/{id} | GET | feature flag प्राप्त करें |
https://api.optimizely.com/v2/audiences | GET | audiences list करें |
https://api.optimizely.com/v2/events | GET | tracked events list करें |
https://logx.optimizely.com/v1/events | POST | events ट्रैक करें (SDK endpoint) |
कोड उदाहरण
कनेक्टर शुरू करें
import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({ apiKey: process.env.TAJO_API_KEY, brevoApiKey: process.env.BREVO_API_KEY});
await tajo.connectors.connect('optimizely', { accessToken: process.env.OPTIMIZELY_ACCESS_TOKEN, sdkKey: process.env.OPTIMIZELY_SDK_KEY, projectId: '12345678'});Experiment Decisions को Brevo से Sync करें
// experiment decisions ट्रैक करें और Brevo से sync करेंconst optimizelyClient = optimizelySDK.createInstance({ sdkKey: process.env.OPTIMIZELY_SDK_KEY});
await optimizelyClient.onReady();
// decision notification listener register करेंoptimizelyClient.notificationCenter.addNotificationListener( optimizelySDK.enums.NOTIFICATION_TYPES.DECISION, async (decisionObject) => { const { type, userId, attributes, decisionInfo } = decisionObject;
if (type === 'feature' || type === 'ab-test') { const email = attributes.email; if (email) { await tajo.contacts.update(email, { attributes: { EXPERIMENT_NAME: decisionInfo.experimentKey || decisionInfo.featureKey, VARIATION_NAME: decisionInfo.variationKey, FEATURE_ENABLED: decisionInfo.featureEnabled || false, EXPERIMENT_DATE: new Date().toISOString() } }); } } });Experiment Results Sync करें
// experiment results लाएं और winning segments sync करेंconst resultsResponse = await fetch( `https://api.optimizely.com/v2/experiments/${experimentId}/results`, { headers: { 'Authorization': `Bearer ${process.env.OPTIMIZELY_ACCESS_TOKEN}` } });
const results = await resultsResponse.json();
// variations process करें और contact segments अपडेट करेंfor (const variation of results.metrics) { const isWinner = variation.is_improvement && variation.statistical_significance >= 0.95;
if (isWinner) { // winning variation में users के लिए Brevo segment बनाएं console.log(`Winning variation: ${variation.variation_name}`); }}Feature Flag-आधारित Segmentation
// user segmentation के लिए feature flags का मूल्यांकन करेंasync function syncFeatureFlags(userEmail, userId) { const features = ['new_checkout', 'loyalty_program', 'ai_recommendations']; const enabledFeatures = [];
for (const feature of features) { const user = optimizelyClient.createUserContext(userId, { email: userEmail }); const decision = user.decide(feature);
if (decision.enabled) { enabledFeatures.push(feature); } }
await tajo.contacts.update(userEmail, { attributes: { ENABLED_FEATURES: enabledFeatures.join(', '), FEATURE_FLAGS_SYNCED: new Date().toISOString() } });}Rate Limits
| Endpoint | Limit | नोट्स |
|---|---|---|
| REST API | 50 req/min | प्रति personal access token |
| Results API | 10 req/min | अधिक latency, भारी queries |
| SDK Event Dispatch | 10,000 events/batch | SDK event processor के माध्यम से |
| Datafile CDN | असीमित | auto-updates के साथ cached |
Results API Latency
Experiment Results API बड़े datasets को process करता है और respond करने में 30+ सेकंड ले सकता है। अपने application को block होने से बचाने के लिए async polling या caching का उपयोग करें।
समस्या निवारण
| समस्या | कारण | समाधान |
|---|---|---|
| 401 Unauthorized | Token expired/invalid | Personal Access Token पुनः generate करें |
| SDK ready नहीं | Datafile load नहीं हुआ | onReady() promise के resolve होने की प्रतीक्षा करें |
| कोई decisions log नहीं | Notification register नहीं | decisions करने से पहले listener register करें |
| पुराने feature flags | Datafile cache | auto-refresh के लिए updateInterval सेट करें |
| गायब results | Experiment शुरू नहीं | सत्यापित करें कि experiment status “running” है |
Debug Mode
connectors: optimizely: debug: true log_level: verbose log_decisions: true log_events: trueसर्वोत्तम प्रथाएं
- Decisions के लिए SDK का उपयोग करें - real-time flag evaluation के लिए SDK, management के लिए REST API का उपयोग करें
- Event batching लागू करें - network overhead कम करने के लिए SDK events को batch करें
- Datafile cache करें - उपयुक्त intervals के साथ auto-update enable करें
- Winning variations sync करें - experiments समाप्त होने के बाद contact segments अपडेट करें
- Targeting के लिए attributes का उपयोग करें - audience matching के लिए email और user attributes pass करें
- Experiment status monitor करें - केवल running या concluded experiments से data sync करें
सुरक्षा
- Personal Access Tokens - REST API के लिए Bearer token authentication
- SDK key isolation - प्रति environment (dev, staging, prod) अलग SDK keys
- Server-side evaluation - exposure रोकने के लिए feature flags को server-side मूल्यांकन करें
- Token rotation - Personal Access Tokens को समय-समय पर rotate करें
- Minimal permissions - जब write access की आवश्यकता न हो तो read-only tokens का उपयोग करें
- Encrypted transport - सभी API और SDK communications के लिए TLS 1.2+