• Resolved weismannweb

    (@weismannweb)


    Hi,

    I created this GIST because I wanted to load some javascript before redirecting so I could track visitors via Facebook Pixel, Mautic, Google Analytics etc etc.

    If your site outputs those tracking codes in the header or footer then you just need to change the redirect from server-side to javascript on the client-side and probably wait 3 or so seconds for the js to load. So that is what I have done with the GIST below.

    If the author of the plugin is interested in having this in the core codebase I can add a field for which page to use and a new redirect type that inherits WordPress redirect type. IF not I may try and find time to make a plugin for it. Either way only if anyone is interested. Thanks!

    https://gist.github.com/weismannweb/f1febe71e9f638d7d31464247d357961

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Godley

    (@johnny5)

    Thanks for the work, and I hope it proves useful to people.

    One note is that these interstitial pages aren’t really redirects, and only work for browsers. The original page still exists, will return a HTTP 200 code, and will be indexed by Google.

    There is a feature request to do this in a way that doesn’t require JavaScript:

    https://github.com/johngodley/redirection/issues/477

    I would add some output escaping to the URL in your gist otherwise you could create a security issue.

    Thread Starter weismannweb

    (@weismannweb)

    There was an issue with logging into the admin. So now I am doing it only if it is a redirection redirect with a target. Also, I am using that to get the target URL too now using the hook redirection_url_target. I will add output escaping later. Unfortunately, this will add an interstitial to all redirection redirects. Maybe in the future, I will add a setting to redirects to do an interstitial only for some based on selecting which ones. I dont ne3ed a real redirect. I am only using redirection for my own short url service. The WordPress is otherwise blank.

    Thread Starter weismannweb

    (@weismannweb)

    John,

    Is there a hook to add when matched option. If not then maybe I should use a group?: https://prnt.sc/ro1pkr

    Is there a hook to get the group a redirect belongs to? Can we get it from source or target hooks or some other hook?

    Plugin Author John Godley

    (@johnny5)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Interstitial JavaScript Redirect with Redirection’ is closed to new replies.