SwapTopic Conversions
Back to Documentation
Setting Up Conversion Tracking
Conversions are key actions that visitors take on your site. SwapTopic lets you track these actions to measure the effectiveness of your personalizations.
Conversion Paths
Set up conversion tracking by defining URL paths that represent successful conversions:
- Navigate to the Conversions Paths tab
- Enter up to 3 URL paths (e.g.,
/checkout-success
,/thank-you
,/subscription-confirmed
) - Click Save Conversion Paths
When visitors access these pages, they’re automatically marked as “converted,” allowing you to:
- Track conversion rates for different content variations
- Target personalized content to converted or non-converted users
- Analyze which personalizations drive the most conversions
The Conversion Rule
Target visitors based on their conversion status:
Rule Type: Converted User
This rule displays content only to visitors who have completed a conversion. For non-converted users, create a rule with:
Rule Type: Not Converted
Tracking Conversions Programmatically
JavaScript Method
Trigger conversions without page navigation using JavaScript:
// Mark the current visitor as converted
window.swapTopicTrackConversion();
// Example: Track conversion on button click
document.getElementById('signup-button').addEventListener('click', function() {
window.swapTopicTrackConversion();
});
This is useful for single-page applications or when the conversion doesn’t involve a page change.
URL Parameter Method
Trigger a conversion by adding a parameter to any URL:
https://yourstore.com/current-page?swaptopic_convert=true
This approach works well for tracking conversions from email links or external sources.
Advanced Conversion Tracking
Integrating with Analytics
SwapTopic automatically sends conversion data to Google Analytics (if enabled in Settings):
// This happens automatically when a conversion is tracked
gtag('event', 'swaptopic_conversion', {
variation_ids: '[variation-ids]',
visit_count: 3
});
Checking Conversion Status
Test if a user has converted:
const userData = window.swapTopicGetData();
if (userData.converted) {
// User has converted
} else {
// User has not converted yet
}
Best Practices
- Use specific success pages: Create dedicated conversion confirmation pages when possible
- Track meaningful actions: Only track significant actions that indicate true success
- Test your conversion tracking: Verify conversions are being recorded correctly
- Consider the customer journey: Create different content for pre and post-conversion experiences
- Be patient with data: Allow time to collect sufficient conversion data before making decisions