The following snippet lets you redirect users to a plan-specific page from a holding page. This allows you to create links to this page and then redirect them to the plan-specific page, depending on the user's plan.

Depending on your need, you might be looking for:

👉 Redirect to a plan-specific page post signup, ie. before they create a password
👉 Redirect to a plan-specific page post all logins, aka when a user logs in
👉 Redirect the user back to a protected content page they were attempting to access after login

The snippet

Add the provided custom code snippet (found between <!-- ✨ Custom Code Snippet Start ✨ --> and <!-- ✨ Custom Code Snippet End ✨ -->) to the head of the holding page. The Outseta Script Options and Outseta Script should already be added to the page either globally or for the specific page.

The script will 1. map your plan's unique IDs with their respective pages, and 2. redirect the user to the correct page when the current user resolves.

Remember to substitute lines in Step 1 with your plan UIDs and paths.

<!-- Outseta Script Options -->
<script>
var o_options = {
domain: '[your-domain].outseta.com',
};
</script>

<!-- Outseta Script (doing all the magic) -->
<script src="https://cdn.outseta.com/outseta.min.js" data-options="o_options"></script>


<!-- ✨ Custom Code Snippet Start ✨ -->
<script>
// 1. Map your plan UIDs with their respective plan specific pages
const plansToLandingPage = {
// Create one line per plan (as many as you’d like),
// replacing the examples with your plan UIDs and plan paths
  ['planUidA']: '/path-to-plan-A-page',
['planUidB']: '/path-to-plan-B-page',
['L9PozjQJ']: '/path-to-plan-L9PozjQJ-page',
};

// 2. Redirect to the plan page, if no plan page is found
// the user stays on this page
const user = Outseta.getUser().then((user) => {
const planUid = user?.Account?.CurrentSubscription?.Plan?.Uid;
const redirectPath = plansToPaths[planUid];
if (redirectPath) {
// If a path is defined, redirect
const url = new URL(redirectPath, window.origin);
window.location = url;
}
});
</script>
<!-- ✨ Custom Code Snippet End ✨ -->

To find your plan UIDs, go to Billing > Plans, then the name of any given plan. The UID may be copied using the button in the top right.

Full Demo on Code Sandbox