We are trying to set up a test to redirect customers that land on a specific page to a new URL. We are concerned looping could occur. Essentially, the customer will continue to be redirected to the redirect page. Is there any way to limit the redirect only to occur 1 time (only on the first hit)?
patterhl , If you are redirecting visitors landing on www.domain1.com to www.domain2.com, and activity location is www.domain1.com, then there shouldn't be any infinite redirect loop. If you setup an XT activity and use use a custom profile script to capture that the hit no, then you could restrict the visitors to get redirected only once as on second visit they would be re-evaluated and no longer match the criteria.
Let's say we have an affiliate link that lands on the homepage of a website. We want to redirect this affiliate link to a different page that is. Now if the customer clicks on the homepage, they will then get redirected to the new page. So, my question is how do we limit this to occur only on the first hit to the site, so the customer does not get stuck in a constant loop.
I've seen this before it usually happens when the URL you are redirecting to matches one of the rules for activity entry URL condition. Please investigate the Activity Entry URL and any additional URLs to see if they match the redirect to URL and let me know if that was the case here.
Using a profile script you can create a variable to store whether that user has seen the page. For this you can use a page count logic (as in my experience the profile script ran before the test so a boolean "did the user see the page true/false" always resolved to true and therefore didn't work):
Profile script named "PageCount"
var UserPageCount = user.get("PageCount") || 0; // initialises at 0 if not currently attached to the user
/* your redirect logic i.e. mbox.param('pageName') === 'the redirected from page' */ &&
UserPageCount <= 1 // using 1 instead of 0 because script runs before test (so basically starts at 1 despite the variable being initialised at 0
return UserPageCount + 1;
Then in your test you can handle the redirect using custom code as follows: