SOLVED

Re-direct page no longer redirecting to pdf asset

Go to solution
Michael_Guanci
Level 2

Re-direct page no longer redirecting to pdf asset

Hi Everyone,

A few months ago I started running into the issue around the email sercuity bot scanners counting false clicks in marketo.  One way to combat this was following Sanford Whitemanblog post around using the redirect page as a way to find the true clicks with a web visit along with the email click.

The problem I have ran into recently is the re-direct page is no longer re-directing to the asset.  Instead, I get a blank page and no longer get the 4 dots at the top and then the pdf appears.  I noticed this issue has been happening for the past two weeks and was wondering if any other people have run into this issue as well.

I always start the URL the same with http://pages.abc.com/Asset-Redirect#{asset url}

I can attach the code I have on the page as well if that might help indicate what might be the issue. 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Re-direct page no longer redirecting to pdf asset

You have a typo in the JS. Looks like you added another allowed domain at some point but left out a comma.

allowedOrigins = [

         'http://pages.brainshark.com',

         'http://www.brainshark.com',

         'https://brainshark.com',

         'https://www.brainshark.com/resources/'

         'http://offers.brainshark.com/',

        ],

should be

allowedOrigins = [

         'http://pages.brainshark.com',

         'http://www.brainshark.com',

         'https://brainshark.com',

         'https://www.brainshark.com/resources/',

         'http://offers.brainshark.com/'

        ],

(If you look in your browser's F12 console you'll see the resulting error "SyntaxError: Unexpected string".)

View solution in original post

6 REPLIES 6
Dan_Stevens_
Level 10 - Champion Alumni

Re: Re-direct page no longer redirecting to pdf asset

The purpose of this technique is not to combat false positives from link scanners, but to provide a more positive experience for the end-user.  Normally, you want to direct all email clicks to your website to convert (e.g, download the PDF file) so that they can also be cookied with the Munchkin tracking code.  If you just provided a PDF link in your email, the user wouldn't be cookied.  Sanford's technique not only minimizes the clicks it takes to download the PDF file, but also cookies the user - without having to visit a landing page.

And yes, both the link that you're using, along with the code will help Sanford diagnose this issue for you.

Dan_Stevens_
Level 10 - Champion Alumni

Re: Re-direct page no longer redirecting to pdf asset

I just tested this in our instance and it's working fine.  Here's a sample link: https://pages.avanade.com/process-redirect.html#https://www.avanade.com/~/media/asset/thinking/digit...

Michael_Guanci
Level 2

Re: Re-direct page no longer redirecting to pdf asset

Here is the code on the redirect page template

<!DOCTYPE html>

<html>

  <head>

<script type="text/javascript">

  document.write(unescape("%3Cscript src='//munchkin.marketo.net/munchkin-beta.js' type='text/javascript'%3E%3C/script%3E"));

</script>

<script>

  Munchkin.init('744-KEV-407'); // your Munchkin ID and options, obviously!

</script>

<script>

  (function(redirectTarget){

    var allowedOrigins = [

         'http://pages.brainshark.com',

         'http://www.brainshark.com',

         'https://brainshark.com',

         'https://www.brainshark.com/resources/'

         'http://offers.brainshark.com/',

        ], // which domains are allowed for redirection

        redirectMs = 3500, // how long before redirecting 

        progressMs = 500,  // how long between updates of the "progress meter"

        progressChar = '&bull;', // progress character (HTML bullet)

        errNoAsset = 'Asset URL not found.', // message when no asset in hash

        errInvalidAsset = 'Asset URL not allowed.', // when asset not our domain

        progress = setInterval(function(){

          if (redirectTarget) {

            document.body.insertAdjacentHTML('beforeend',progressChar);

          } else {

            clearInterval(progress), clearTimeout(redirect);         

            document.body.insertAdjacentHTML('beforeend',errNoAsset);         

          }

        }, progressMs),

        redirect = setTimeout(function(){        

            var redirectLoc = document.createElement('a');

            redirectLoc.href = redirectTarget;

            redirectLoc.origin = redirectLoc.origin ||

                [redirectLoc.protocol,

                  '//',

                  redirectLoc.hostname,

                  ['http:','http:80','https:','https:443']

                    .indexOf(redirectLoc.protocol+redirectLoc.port) != -1

                      ? ''

                      : ':' + redirectLoc.port

                ].join('');

            clearInterval(progress);

            if (allowedOrigins.indexOf(redirectLoc.origin) != -1) {           

              document.location.href = redirectTarget;

            } else {

              document.body.insertAdjacentHTML('beforeend',errInvalidAsset);                  

            }

        }, redirectMs);

    })(document.location.hash.substring(1));

</script>

    <meta charset="utf-8">

    <meta class="mktoString" mktoName="Variable 1" id="var1" default="This is a variable">

    <title></title>

    <style>

      body {background:#fff;}

    </style>

  </head>

  <body>

  </body>

</html>

Michael_Guanci
Level 2

Re: Re-direct page no longer redirecting to pdf asset

And an example of a URL that should (in theory) work (and worked when we sent this in an email in the past).

http://pages.brainshark.com/Asset-Redirect#http://pages.brainshark.com/rs/744-KEV-407/images/Sales_E...

SanfordWhiteman
Level 10 - Community Moderator

Re: Re-direct page no longer redirecting to pdf asset

You have a typo in the JS. Looks like you added another allowed domain at some point but left out a comma.

allowedOrigins = [

         'http://pages.brainshark.com',

         'http://www.brainshark.com',

         'https://brainshark.com',

         'https://www.brainshark.com/resources/'

         'http://offers.brainshark.com/',

        ],

should be

allowedOrigins = [

         'http://pages.brainshark.com',

         'http://www.brainshark.com',

         'https://brainshark.com',

         'https://www.brainshark.com/resources/',

         'http://offers.brainshark.com/'

        ],

(If you look in your browser's F12 console you'll see the resulting error "SyntaxError: Unexpected string".)

Michael_Guanci
Level 2

Re: Re-direct page no longer redirecting to pdf asset

I figured it was something in the code I wasn't seeing.  Thank you Sanford as always!