This website uses necessary cookies to ensure that our website is ideally usable. We do not use cookies that process personal data without your prior consent. Read our Cookie Policy

What is the difference between a 301 and JavaScript redirection?

book reader icon
1 Minute
facebook logo gray
linkedin logo gray
mail logo gray

In your account settings you can choose if the user will be redirected with a 301-redirect or through JavaScript when scanning a QR Code. So what is the difference?

A 301-redirect calls the target page directly whereas a JavaScript redirect loads a page first where JavaScript code is executed to redirect to the target page.

301-redirect

A 301-redirect tells the browser to immediately go to the target website. When you scan a QR Code the Shorted URL in the code will be requested by the browser. The browser receives an instruction by our server to go to directly to the target page in the header of the response e.g.

Status 301 Moved Permanently
location: https://www.yourwebsite.com

JavaScript Redirect

When you select to redirect with JavaScript an intermediate blank website is loaded first in the browser. On this page cookies are set, scripts for re-targeting are loaded or the GPS location may be retrieved before redirecting the user to the target website. Then the target page is loaded via a JavaScript instruction e.g.

<script>window.location='https://www.yourwebsite.com';</script>

We use JavaScript redirections to execute tracking scripts or to ask the user for consent before he is being tracked with third party tracking services.

If you enter a GA Tracking ID, Google Tag Manager ID or Facebook Pixel ID or a custom snippet in the External Tracking / Re-Targeting section of your account settings, the redirection method will be automatically set to JavaScript.

Setting the redirection method to JavaScript will allow you to use information of the referring QR Code on your webhooks.

<script>alert(document.referrer)</script>
Last update 1 year ago