SwapTopic Settings In-Depth

Back to Documentation

Site Settings

Site Title

The name of your site as displayed in the SwapTopic dashboard. This helps you identify your site when managing multiple properties.

Allowed Domain

The domain where your SwapTopic script is authorized to run. Personalization will only work on this domain and its subdomains. For security reasons, attempts to use your API key on unauthorized domains will be blocked.

Google Analytics Integration

When enabled, SwapTopic automatically sends personalization data to your Google Analytics account, allowing you to analyze the performance of your personalizations in your existing analytics setup.

Preview Mode

Controls access to the Preview and Setup tools:

  • Enabled: Allows access to the preview and setup UI via URL parameters
  • Disabled: Blocks access to preview and setup features for security or production environments

Embed Code

The JavaScript snippet that powers SwapTopic personalization. Place this code immediately before the closing </head> tag in your site’s HTML.

<script src="https://cdn.swaptopic.com/sites/[your-site-id]/script.js"></script>

Site Setup & Preview

Preview Site

Opens your website with the ?swaptopic=preview parameter, activating the preview interface that allows you to:

  • View all configured personalizations
  • Test different variations
  • Check which rules are active

Site Setup

Opens your website with the ?swaptopic=setup parameter, enabling the element selector tool that helps you:

  • Click on any element to copy its CSS selector
  • Easily identify the correct selectors for personalizations
  • Test element targeting without coding knowledge

Cache Management

Invalidate Cache

Forces the CDN to refresh your personalization script. Use this after making changes if you don’t see your updates reflected on your site. Cache invalidation is limited to once every 15 minutes to prevent abuse.

Browser Cache Issues

Sometimes browser caching prevents you from seeing your latest changes even after invalidating the CDN cache:

  • Hard Refresh: Use Shift+Reload or Ctrl+Shift+R (Cmd+Shift+R on Mac) to force a cache refresh
  • Incognito/Private Mode: Test in an incognito window which uses a fresh cache
  • Alternative Browser: Try viewing your site in a different browser
  • Device Testing: Check on mobile devices which may have separate caches
  • Clear Browser Cache: In extreme cases, clear your browser’s cache completely

Note: When testing personalizations, it’s good practice to use incognito mode to avoid interference from previous sessions and cached data.

Advanced Configuration Options

Custom JavaScript Integration

For advanced users, SwapTopic can be customized using data attributes:

<script 
  src="https://cdn.swaptopic.com/sites/[your-site-id]/script.js"
  data-disable-ga="true"
  data-visit-timeout="3600000"
></script>

Available data attributes:

Attribute Default Description
data-disable-ga false Disable Google Analytics integration
data-visit-timeout 1800000 Time in milliseconds before a new visit is counted (default: 30 minutes)
data-debug false Enable debug logging to console

API Key Security

Your API key is embedded in your personalization script but is only valid for the domains you specify. For enhanced security:

  1. Regularly check your allowed domains
  2. Disable preview mode in production environments
  3. Use HTTPS for all personalization content