Link cloaking

This guide explains how to use the force_quiz_id parameter to implement quiz cloaking, allowing you to show different quiz content to different users while maintaining the same URL.

What is Quiz Cloaking?

Quiz cloaking is a technique that allows you to display different quiz content to different users or traffic sources using the same URL. This is particularly useful for:

  • Ad Platform Compliance: Display compliant content to ad reviewers while showing your actual content to real users
  • Traffic Source Segmentation: Show different quizzes based on traffic source (Facebook, Google, TikTok, etc.)
  • Geographic Targeting: Display region-specific content while maintaining a single URL
  • User Segmentation: Show different content to different user segments

How It Works

The force_quiz_id mechanism works in two stages:

  1. Initial Redirect: When a user visits a URL with force_quiz_id, the system:
    • Looks up the quiz by the provided ID
    • Sets cookies to force that specific quiz slug
    • Redirects to the same URL without the force_quiz_id parameter

Basic Usage

Step 1: Get Your Quiz IDs

First, identify the quiz IDs you want to use for cloaking:

  • Source Quiz: The quiz that appears in the public URL (e.g., https://yourdomain.com/quiz/main-quiz)
  • Cloaked Quiz: The quiz you want to show instead (e.g., a compliant version, A/B test variant, etc.)

Step 2: Add force_quiz_id Parameter

Append force_quiz_id as a query parameter to your quiz URL:

https://yourdomain.com/quiz/main-quiz?force_quiz_id=123

Where 123 is the ID of the quiz you want to force.

Step 3: System Behavior

When a user visits this URL:

  1. The system identifies the quiz with ID 123
  2. Sets cookies:
    • force_quiz_slug:{projectId}:{slug} - Forces the quiz slug
    • force_paywall_slug:{projectId}:{paywallSlug} - Forces the paywall slug (if applicable)
  3. Redirects to: https://yourdomain.com/quiz/main-quiz (without force_quiz_id)
  4. The user sees the quiz with ID 123 instead of the default quiz

Step 4: Cookie Persistence

The cookies persist for 120 minutes (2 hours). During this time:

  • Users visiting the original URL will automatically see the forced quiz
  • The cloaking is transparent to the user
  • No additional parameters are needed in the URL

Examples

Example 1: Simple Cloaking

Scenario: You want to show quiz ID 456 when users visit /main-quiz

URL to use:

https://yourdomain.com/main-quiz?force_quiz_id=456

What happens:

  1. User visits the URL with force_quiz_id=456
  2. System redirects to /main-quiz (without parameter)
  3. User sees quiz ID 456 instead of the default quiz
  4. Cookie ensures they continue seeing quiz 456 for 2 hours

Example 2: Ad Platform Compliance

Scenario: Show compliant content to ad reviewers, real content to users

Compliant Quiz URL (for ad platform review):

https://yourdomain.com/main-quiz?force_quiz_id=999

Real Quiz URL (for actual users):

https://yourdomain.com/quiz/main-quiz

The compliant quiz (ID 999) contains only approved content, while the default quiz contains your actual marketing content.

Clearing Cloaking

To clear the forced quiz and return to the default:

  • Clear browser cookies for your domain
  • Wait 2 hours for cookies to expire
  • Visit the URL without force_quiz_id in a new session