SOLVED

Re: Global Thank you page

Go to solution
Kevin_Charette1
Level 2

Global Thank you page

Hi there,

I am new to Marketo and wanted to hear best practice on gated content. I am embedding a global form on each of our assets. On submission of the form I would like to do the following:

1/ send an email with the content (figured this piece out - basically just using a program with the referral url of the form)

2/ redirect them to a Thank you page with a download link to the content

For the Thank you page I am not sure if its best practice to have a global thank you page that somehow changes based on the same form but the different referral link or if I should just have a Thank you template in the program that uses tokens but that the form redirects them too based on maybe a hidden field?

Thanks,

Kevin

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Global Thank you page

You add the fields to the Thank You URL before redirecting, using the Forms 2.0 JS API.

Say you have the asset URL and asset name in these two (global) JS variables on the form page:

lastAssetURL

lastAssetFriendly

Then use an onSuccess listener to add those to the TY URL:

MktoForms2.whenReady(function(form) {

   form.onSuccess(function(vals, tyUrl) {

      var tyLoc = document.createElement("a"),

         assetInfo = {

            assetURL: lastAssetURL,

            assetFriendly: lastAssetFriendly

         };

      tyLoc.href = tyUrl;

      tyLoc.hash = encodeURIComponent(btoa(JSON.stringify(assetInfo)));

      document.location = tyLoc;

      return false;

   });

});

Then JSON.parse(atob(decodeURIComponent(document.location.hash.substring(1)))) on the Thank You page, which will give you the asset info to inject dynamically into the page body.

If this isn't getting clearer, you should involve a Marketo-fluent JS dev.

View solution in original post

9 REPLIES 9
Josh_Hill13
Level 10 - Champion Alumni

Re: Global Thank you page

If you are new, stick to the simple program:

  • Program
    • Page
    • Global Form (in Design Studio)
    • TY Page with Asset
    • Campaign: Fills Out Form trigger (don't use Referral URL)
      • Send Email
      • Do stuff
Kevin_Charette1
Level 2

Re: Global Thank you page

The page is not a Marketo Landing Page

SanfordWhiteman
Level 10 - Community Moderator

Re: Global Thank you page

Yes, you certainly can use a global Thank You page (not just a global template but a single page).  This is the only way to stay sane if you have a large asset library!

Pass the asset's URL (and possibly its friendly name) in the query string. Then dynamically build the download link on the TY page.

Kevin_Charette1
Level 2

Re: Global Thank you page

How would I pass it through from the 3rd party site to a Marketo Thank you Page (more hidden form fields?)

Kevin_Charette1
Level 2

Re: Global Thank you page

What I am thinking is we have a hidden field for the link and the name of the content that save on the lead when they submit the form. Then when they reach the global thank you page, the link the is lead.content_download_link with the name of it being lead.content_name.

Is that what you are talking about? Or is there a way to do this without saving it on the lead? This seems like a hacky way of doing it?

SanfordWhiteman
Level 10 - Community Moderator

Re: Global Thank you page

What I am thinking is we have a hidden field for the link and the name of the content that save on the lead when they submit the form. Then when they reach the global thank you page, the link the is lead.content_download_link with the name of it being lead.content_name.

Actually, you must avoid approaches like that because the session is not guaranteed to be associated, and the token values updated, by the time the next page renders (it may work most of the time, but you will find yourself in a world of confusion if you trust it to work every time -- the system does not make this "contract" with a form submit).

I'm talking about putting the downloadable asset's URL + friendly name in the query string or hash of the Thank You URL.  I usually put it in the #hash because it's easy to parse and less likely to be used for anything else on the TY page.

Kevin_Charette1
Level 2

Re: Global Thank you page

Sorry, I don't understand; where would I change that once the form is filled.

SanfordWhiteman
Level 10 - Community Moderator

Re: Global Thank you page

You add the fields to the Thank You URL before redirecting, using the Forms 2.0 JS API.

Say you have the asset URL and asset name in these two (global) JS variables on the form page:

lastAssetURL

lastAssetFriendly

Then use an onSuccess listener to add those to the TY URL:

MktoForms2.whenReady(function(form) {

   form.onSuccess(function(vals, tyUrl) {

      var tyLoc = document.createElement("a"),

         assetInfo = {

            assetURL: lastAssetURL,

            assetFriendly: lastAssetFriendly

         };

      tyLoc.href = tyUrl;

      tyLoc.hash = encodeURIComponent(btoa(JSON.stringify(assetInfo)));

      document.location = tyLoc;

      return false;

   });

});

Then JSON.parse(atob(decodeURIComponent(document.location.hash.substring(1)))) on the Thank You page, which will give you the asset info to inject dynamically into the page body.

If this isn't getting clearer, you should involve a Marketo-fluent JS dev.

Kevin_Charette1
Level 2

Re: Global Thank you page

One thing to note here is that the global thank you page is a Marketo Landing Page. But I wouldn't know how to reference the url in the content of the landing page.