A/B test - Redirect to test URL causes a flicker and shows the default page while Variant Query Parameters cause looping and data mismatch in GA4/AEP | Community
Skip to main content
VidyR
Adobe Champion
Adobe Champion
January 30, 2026
Solved

A/B test - Redirect to test URL causes a flicker and shows the default page while Variant Query Parameters cause looping and data mismatch in GA4/AEP

  • January 30, 2026
  • 2 replies
  • 91 views

We are A/B testing an experience where Cohort B is redirected to a ‘/page-b’ while cohort A should see the default ‘/page-a’.

What was happening initially- 

Initially we used AT’s redirect offers but it was conflicting with our Next.js routing/CDN . It caused flickering and messed up React's hydration process. It also prevented us from getting correct readings for our test experience in GA4

This is what we did as a bypass solution -

  1. Created the A/B test using FEC with a redirect mbox and a JSON offer.
  2. Created a middleware at the Next.js level that intercepted the request from a user’s device on our server before the page loads (before any HTML is sent)
  3. It calls Adobe Target's Edge Network to get the redirect decision asking  "Should I redirect this user?" and Target responds with either a redirect decision or no action.
  4. If a redirect is needed, the middleware sends a display notification to Target for analytics tracking, then performs the redirect, and the user lands on the destination page having never seen the original page.
  5. The _app.js code then reads URL parameters and populates ttMeta so analytics can track which experiment the user is in.

Question 1: Is there a better way to resolve our issue than what we implemented? And do you think this has anything to do with our architecture and doing this server-side?

p.s. we also have client side webSDK deployed that sends data to AEP. And we are in the process of migrating our content to AEM cloud. But we are not getting rid of our Next.js front-end for now. We are taking a hybrid approach (this info. should not impact my actual question related to AT, I hope)

Best answer by Perrin_Ennen

Hi ​@VidyR, have you tried using an HTML offer with a JavaScript-based redirect instead of a redirect offer, and did that behave any better in your setup?

From my experience, this would likely still cause similar issues like flicker, extra pageviews, or double tracking unless the architecture explicitly prevents intermediate renders. The redirect logic probably needs to be handled very carefully to avoid unnecessary pageview tracking or infinite redirect loops caused by parameters.

Hope this helps you.

2 replies

Perrin_Ennen
Community Advisor
Perrin_EnnenCommunity AdvisorAccepted solution
Community Advisor
February 9, 2026

Hi ​@VidyR, have you tried using an HTML offer with a JavaScript-based redirect instead of a redirect offer, and did that behave any better in your setup?

From my experience, this would likely still cause similar issues like flicker, extra pageviews, or double tracking unless the architecture explicitly prevents intermediate renders. The redirect logic probably needs to be handled very carefully to avoid unnecessary pageview tracking or infinite redirect loops caused by parameters.

Hope this helps you.

VidyR
Adobe Champion
VidyRAdobe ChampionAuthor
Adobe Champion
March 3, 2026

Thank you ​@Perrin_Ennen . We were trying to redirect the user to a new page because deploying content variations (e.g. hero-banner-test) on the same page was causing high flicker on page load using WebSDK.
We are now relying on component wrappers within our next.js layer that interacts with AEM to fetch the json offer directly and our server deploys the experience instead of client-side WebSDK. So that helped remove the flicker. We are still testing though!

Vishal_Anand
Level 5
February 11, 2026

@VidyR Try this pre-hiding snippet: 

<script>
//prehiding snippet for Adobe Target with asynchronous tags deployment
;(function(win, doc, style, timeout) {
var STYLE_ID = 'at-body-style';
function getParent() {
return doc.getElementsByTagName('head')[0];
}
function addStyle(parent, id, def) {
if (!parent) {
return;
}
var style = doc.createElement('style');
style.id = id;
style.innerHTML = def;
parent.appendChild(style);
}
function removeStyle(parent, id) {
if (!parent) {
return;
}
var style = doc.getElementById(id);
if (!style) {
return;
}
parent.removeChild(style);
}
addStyle(getParent(), STYLE_ID, style);
setTimeout(function() {
removeStyle(getParent(), STYLE_ID);
}, timeout);
}(window, document, "body {opacity: 0 !important}", 3000));
</script>


Additional read: https://experienceleague.adobe.com/en/docs/platform-learn/implement-in-websites/implement-solutions/target#add-the-target-pre-hiding-snippet

 

VidyR
Adobe Champion
VidyRAdobe ChampionAuthor
Adobe Champion
March 3, 2026

Thanks for the input Vishal. But we already have this pre-hiding snippet added.