Hi everyone,
Is there a way to have a landing page expire after a certain period of time? For example say for a webinar registration page, after the webinar date the page would direct to a "this event has occurred" kind of message? Or would this be a manual process of going back and editing the page after the event has happened?
Looking forward to everyone's thoughts!
Thanks!
Alec
Solved! Go to Solution.
Search the Community as this has been answered before. Basically, there is no true expiry but you can add a standard JS snippet to every page that, together with a {{my.token}} storing the expiration date, can redirect people to a "Thanks... for trying" page/popup/etc.
Search the Community as this has been answered before. Basically, there is no true expiry but you can add a standard JS snippet to every page that, together with a {{my.token}} storing the expiration date, can redirect people to a "Thanks... for trying" page/popup/etc.
I'll take Sanford's reply a step further.
In your page template, put in this:
<script type="text/html" id="livepage-html">{{my.Live-Page}}</script>
<script type="text/html" id="expiredpage-html">{{my.Expired-Page}}</script>
Then....
<body>
<div id="body-stuff"></div>
</body>
<script>
if (new Date() > new Date('{{my.expiration-date}}')) {
document.getElementById('body-stuff').innerHTML = document.getElementById('expiredpage-html').innerHTML;
} else {
document.getElementById('body-stuff').innerHTML = document.getElementById('livepage-html').innerHTML;
}
</script>
Then, obviously, in your program put in the following tokens:
expiration-date (type DATE)
Live-Page (type RICH TEXT)
Expired-Page (type RICH TEXT)
Here's an example:
Make an expiration page - JSFiddle
... but if both HTML variants are going to be pulled into the DOM no matter what, why contain them in <SCRIPT> tags as you would arbitrary non-HTML data?
It'll be slower to use innerHTML, which causes a reflow and reparse, than to use a hidden parent element and simply move its children under the visible node.
Really appreciate you sharing the code Robb. Just to clarify for the tokens:
Live-Page = Landing page URL
Expired-Page = Re-direct to page with message
Is that right?
Sanford posts "Do a search" and gets marked correct. I post a fiddle and get no love.
The system is rigged.
Sorry man. Joe Reitz you can switch the Correct to Robb. (Though in fairness I posted code, too, if you search. )
I was one "Correct" away from Blogging Rights, but it looks like I got it somehow anyway.
Hi,
I came across your post, but I am struggling. This is my code, but nothing seems to be picked up. I would appreciate any help as I am not a coder. I am using Marketo landing pages. I add this into the live registration landing page
<script type="text/html" id="livepage-html">{{my.ZLive-Page}}</script>
<script type="text/html" id="expiredpage-html">{{my.ZExpired-Page}}</script>
Then....
<div id="body-stuff"><br /></div><script>
if (new Date() > new Date('{{my.ZExpiration-Date}}')) {
document.getElementById('livepage-html').className = "hidden";
document.getElementById('expiredpage-html').className = "shown";
} else {
document.getElementById('livepage-html').className = "shown";
document.getElementById('expiredpage-html').className = "hidden"
}
</script>