THIS ARTICLE WILL HELP YOU:
- Setting Up Experiments
- Communication Between Server-Side and Client-Side
- Best Practices for Seamless Integration
- Conclusion
Integrating Convert.com's Full Stack SDK with the Web Testing project offers a powerful approach to conducting A/B testing, providing flexibility in how variations are assigned and ensuring accurate tracking of user interactions. By leveraging server-side logic for deterministic variation assignment and offering an alternative client-side bucketing option, businesses can tailor their experimentation strategy to fit specific needs. This comprehensive guide outlines both methods, ensuring that you can implement the one that best suits your testing requirements.
Setting Up Experiments
Full Stack Project
Begin by setting up your experiment in the Full Stack project. This setup focuses on server-side variation assignment, using the SDK's deterministic bucketing based on the murmur hash algorithm.
const convertSDK = require('convert-sdk')('YOUR_PROJECT_API_KEY');
const context = convertSDK.createContext('USER_UNIQUE_ID');
const variation = context.runExperience('EXPERIENCE_KEY');
console.log(variation); // Outputs the assigned variation
Web Testing Project
Create a corresponding experiment in the Web Testing project for client-side tracking and analysis of user interactions with the variations.
window._conv_q = window._conv_q || [];
window._conv_q.push(['executeExperiment', 'WEB_TESTING_PROJECT_EXPERIMENT_ID']);
Communication Between Server-Side and Client-Side
After assigning variations on the server-side, communicate this assignment to the client-side effectively by setting a specific cookie. This alignment is crucial for accurate tracking within the Web Testing project.
// Example using Node.js and Express for setting a cookie
res.cookie('_conv_sptest', `FULL_STACK_PROJECT_EXPERIMENT_ID:VARIATION_ID`, { maxAge: 10000, httpOnly: true });
Best Practices for Seamless Integration
- Maintain Experiment Consistency: Ensure alignment in objectives, variations, and expected outcomes between Full Stack and Web Testing projects.
- Clear Variation Communication: Use consistent identifiers for experiments and variations across both projects.
- Comprehensive Testing: Conduct thorough testing to ensure functionality and data accuracy before going live.
Conclusion
Creating separate experiments in both the Full Stack and Web Testing projects enables a comprehensive framework for A/B testing. This approach leverages the advantages of both server-side assignment and client-side tracking for detailed insights and optimized digital experiences.