Hello Community,
I am hoping to reach out to @SanfordWhiteman to firstly say thank you for your endless support and contribution here. Its invaluable for me as a Marketo novice user.
I am trying to implement your awesome blog for creating a redirect that will allow for direct links to a design studio asset: Stop using direct download links (unless you want to lose tracking!) — TEKNKL :: Blog
I am using a Marketo LP for the redirector page and trying to connect this with a Design Studio PDF file.
I have added the code from here: MktoLP :: Redirect Page v1.0.2 (codepen.io) and then added the asset URL to the LP URL (see S/S attached)
As you'll see in the S/S I am seeing 'Asset URL not found' and hoped you could help me troubleshoot?
Landing Page Template HTML:
<!DOCTYPE html>
<html>
<head>
(function(redirectTarget){
var allowedOrigins = [
'https://s.codepen.io',
'https://codepen.io',
'http://example.com'
], // which domains are allowed for redirection
redirectMs = 3500, // how long before redirecting
progressMs = 500, // how long between updates of the "progress meter"
progressChar = '•', // 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));
<meta charset="utf-8">
<title></title>
<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('308-OXI-896'); // your Munchkin ID and options, obviously!
</script>
<script>
(function(redirectTarget){
var allowedOrigins = [
'https://info.ai.baesystems.com',
'https://www.baesystems.com',
'https://baesystems.com'
], // which domains are allowed for redirection
redirectMs = 3500, // how long before redirecting
progressMs = 500, // how long between updates of the "progress meter"
progressChar = '•', // 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>
<style>
body {background:#fff;}
</style>
</head>
<body>
</div>
</body>
</html>
Landing Page URL with Asset URL:
https://info.ai.baesystems.com/World-Defense-Show-Brochure-2024.html#https://info.ai.baesystems.com/rs/308-OXI-896/images/KSA_Brochure_2024.pdf?
Thank you
Cathy
Solved! Go to Solution.
Also, you don't need to have a "?" at the end if you don't have any query parameters!https://info.ai.baesystems.com/World-Defense-Show-Brochure-2024.html#https://info.ai.baesystems.com/rs/308-OXI-896/images/KSA_Brochure_2024.pdf
(Also a ? after the hash doesn’t start a query string, it’s part of the hash!)
@C_Blakeley, this works for me! I can get to the PDF from the URL you mentioned in the question, and I also saw the visitWebpage Munchkin hit in the browser's network activity. Also, you don't need to have a "?" at the end if you don't have any query parameters!
https://info.ai.baesystems.com/World-Defense-Show-Brochure-2024.html#https://info.ai.baesystems.com/rs/308-OXI-896/images/KSA_Brochure_2024.pdf
Also, you don't need to have a "?" at the end if you don't have any query parameters!https://info.ai.baesystems.com/World-Defense-Show-Brochure-2024.html#https://info.ai.baesystems.com/rs/308-OXI-896/images/KSA_Brochure_2024.pdf
(Also a ? after the hash doesn’t start a query string, it’s part of the hash!)
@Darshil_Shah1, Thank you. How odd, its nw working correctly for me and I've updated the ?
Thanks for your help both @SanfordWhiteman
Well, it could be just a bit of processing delay at Marketo's end, due to which the file may not have been accessible right after the second it was uploaded in the Design Studio. This usually doesn't happen, but it isn't new!