How to make a redirection that fired a script before redirecting?

Question

To objection is simple: I want to redirec a page in my site to an external site, but before redirecting the Google Analytics script should be fired, so that I get the report. The Redirection plugin can be used for redirection, but it doesn’t seem to support that. One idea is to create a post and add this:

window.location.replace("http://stackoverflow.com");

but it may increase the loading time. Plus that it doesn’t guarantee that the script will be fired, as it can be included at the footer.

Is there a way to make sure that the script is fired before redirection?

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/how-to-make-a-redirection-that-fired-a-script-before-redirecting/">

How to make a redirection that fired a script before redirecting?</a>
0
, , Ooker 8 months 0 Answers 44 views 0

Leave an answer