SOLVED

Dynamic content suggestion on Thank You page

Go to solution
Highlighted
Anonymous
Not applicable

Dynamic content suggestion on Thank You page

Hi,

I have a "Thank You" page where a user ends up after downloading a piece of content. All my content landing pages points to that "Thank You" page after the user fills out the download form.

I want to include a section "Other content that you might like" on the page that will dynamically display other content that does not include the one that the user has just downloaded.

So far what I've done is create custom lead field "Last Visited Page" which populates with the URL of the content landing page the user is on after the form-fill. Based on that custom field, I've created segments and accompanying snippets that will display the suggested content. However, as the field is populated only after the form-fill, it doesn't update fast enough to be segmented quickly so that the right suggested content will display on the "Thank You" page.

Does anyone have a suggestion on the best way to go about this?

And, is there a way to dynamically display random suggested content without segmentation? (my edition of Marketo does not include RTP)

cheers,

Marilyn

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

Re: Dynamic content suggestion on Thank You page

You can set the full Thank You URL in the browser using the onSuccess handler. (Sorry for the strange spacing, using my phone doesn't let me format.)

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,tyURL){

    switch( vals.Vertical ){ // vals is an object with all the submitted values

       case 'Pharma':

          tyURL = 'thankyou.html?vertical=Pharma';

          break;

       case 'Construction':

          tyURL = 'thankyou.html?vertical=Construction';

          break;

     }

     document.location.href = tyURL;

     return false;

  });

});

View solution in original post

8 REPLIES 8
Highlighted
Level 10 - Community Moderator

Re: Dynamic content suggestion on Thank You page

This has a tremendous overlap with Display Different Text/Asset Images on LP Using Tokens​.

All you need to do is pass the runtime segment to the Thank You URL as a query param.

Highlighted
Anonymous
Not applicable

Re: Dynamic content suggestion on Thank You page

Thanks Sanford. I've read the post and have tested it by creating your example. That's a great tip!

However, I'm now struggling to understand how I can add the ?segment_name=value to the URL after the form is submitted. In my testing example I had to hard code it. Are you able to advise or point me to a tutorial? I'm fairly new at working with query strings.

Highlighted
Level 10 - Community Moderator

Re: Dynamic content suggestion on Thank You page

You can set the full Thank You URL in the browser using the onSuccess handler. (Sorry for the strange spacing, using my phone doesn't let me format.)

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,tyURL){

    switch( vals.Vertical ){ // vals is an object with all the submitted values

       case 'Pharma':

          tyURL = 'thankyou.html?vertical=Pharma';

          break;

       case 'Construction':

          tyURL = 'thankyou.html?vertical=Construction';

          break;

     }

     document.location.href = tyURL;

     return false;

  });

});

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Dynamic content suggestion on Thank You page

Sanford, you're a star. Thank you! Took me a while but I managed to get it to work the way I needed it to. My first javascript attempt too. Thanks a bunch!

Highlighted
Level 10 - Community Moderator

Re: Dynamic content suggestion on Thank You page

Great. If you want to send me your final code privately to sandy@teknkl.com, I can tell you if I see any red flags. If you're trying to learn JS but also deploying production code, it's important to get off on the right foot with maintainable coding techniques (the snippet above is actually more repetitive than I'd use in prod, but in making examples here for non-programmers I sometimes go for one-time clarity over long-term reusability).

Highlighted

Re: Dynamic content suggestion on Thank You page

Thanks for this Sanford!

Sanford Whiteman

I got it to work with embedded code on a standalone HTML page.

What would be best practise to add form scripts to a page based on a Guided Landing Page template? There is no place to add the script except placing it in the header  (where it does not seem to work).

I browsed the community and there does not seem to be a straight forward solution. Can I assume it is a no go to added Form Scripts in a Guided Landing Page?

Would love to hear your thoughts.

- Frank

Highlighted
Level 10 - Community Moderator

Re: Dynamic content suggestion on Thank You page

What would be best practise to add form scripts to a page based on a Guided Landing Page template? There is no place to add the script except placing it in the header (where it does not seem to work).

The reason it doesn't appear to work is that when you have a named <div class="mktoForm"> element on a GLP, the forms2.min.js script is only loaded at the point in the HTML <body> where the <div> appears.

So if you add a script to the <head> that calls a method of the MktoForms2 object, it will fail, since MktoForms2 doesn't exist yet.

The easiest solution is to have your form behaviors scripts load just inside the closing </body> tag.

Highlighted

Re: Dynamic content suggestion on Thank You page

Thanks Sanford!

Placing the script before the closing </body> tag worked like a charm. By placing the minified script in a variable it will be easy to update. I am a happy man.

Have a nice weekend!