Skip to main content

Redirection Middleware

Redirection Middleware is a feature that can help you gain more control on campaign redirection.

tip

Redirection Middleware is not available in Free plan.

How it works?

To use redirection middleware, following these steps:

  1. go to Settings >> Redirection Middleware to set your middleware URL.

remidd-add.png

  1. After defining your middlware, choose "redirection middleware" in the "redirection method" of creation form.

remidd-select.png

Let's say you define a redirection middleware with URL: https://www.mydomain.com/jump?url={target}, and you have a rotator with only one default destination: https://myoffer.com, then when visitors acess this rotator, instead of redirecting to https://myoffer.com, they will be 302 redirected to your middleware first: https://www.mydomain.com/jump?url=https%3A%2F%2Fmyoffer.com, it is your middleware's responsibility to redirect visitors to actual target https://myoffer.com

tip

The target value in middleware will be url encoded.

Template

We have prepared a redireciton middleware template so you can use this feature without coding.

go.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<script>
//modify the parameter name that contains the target url
var targetParameter = "url";

//do not change the code below unless you know what you're doing
var target = getUrlParameter(targetParameter);
if(target){
window.location.href = target;
}else{
document.write("No value from parameter: "+targetParameter);
}
function getUrlParameter(name) {
var regexSearch = "[\\?&#]" + name + "=([^&#]*)";
var regex = new RegExp(regexSearch);
var results = regex.exec(window.location.href);
return results ? decodeURIComponent(results[1]) : '';
}
</script>
</body>
</html>

Copy this code to a html file, let's say the html file name is go.html, upload to your website https://domain.com, then you can put this into the redirection middleware:

https://domain.com/go.html?url={target}

How to turn off redirection middleware?

To turn off redirection middleware, follow these steps:

remidd-empty.png

  1. Leave empty in the middleware URL field.

  2. Update settings.

If you turn off redirection middleware, but there are still rotators set redirection method to middleware, then MaxConv will use a fallback method Meta Refresh - No Referrer for those rotators.