4 Replies Latest reply on Dec 11, 2013 11:47 AM by Jenn DiMaria

    Dynamic Content Based on URL Parameters

    Jenn DiMaria
      I have a landing page whose headline I'd like to change based on a URL parameter (which will vary by call-to-action in an ad, etc).

      This article mentions at the bottom that we can serve dynamic content based on URL parameters: https://community.marketo.com/MarketoTutorial?id=kA250000000Kz1pCAC

      Does anyone know how this is done?  I've tried to create segments by Original Referrer, as well as being added to a list on a "Visited Web Page" trigger, but to no avail.  Any help would be appreciated.

      Thanks!
        • Re: Dynamic Content Based on URL Parameters
          Here's some food for thought: http://moz.com/ugc/dynamic-landing-pages-optimizing-for-natural-search http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
          • Re: Dynamic Content Based on URL Parameters
            It does appear Marketo supports this, but the tutorial doesn't explain how to do it.

            AFAIK the segments are ideal for attributes that are more permanent, such as the location or industry.  With the criteria you want to use, there may be a race condition where the content can not be served in time to the user.  In this case, you'd want the page to pull the content directly from the URL, rather than query the Marketo database.  Jason's suggestions can help with this.
            • Re: Dynamic Content Based on URL Parameters
              I agree with Steven, segments would be the most robust, quickest and simplest method.

              JavaScript may be an option if you need more granularity or more custom options.

              The text or entire block would be placed within HTML block page element. You can cut/paste the relevant source using the HTML button in the editor.

              In that HTML block page element you can read the URL parameter and display the respective content.

              The JavaScript will be similar to:

                   <script language="Javascript" src="/js/public/jquery-latest.min.js" type="text/javascript"></script>
                   <script src="/js/public/jQueryString-2.0.2-Min.js" type="text/javascript" ></script>
                    
                   <script>
                    
                     // to set cookies.  Uses noConflict just in case
                    
                     var $jQ = jQuery.noConflict();
                    
                     var pState = $jQ.getQueryString({ ID: "State" });
                    
                    
                    
                   switch(pState)
                   {
                   case 1:
                     execute code block 1
                     break;
                   case 2:
                     execute code block 2
                     break;
                   default:
                     code to be executed if n is different from case 1 and 2
                   } 
                    
                    
                   </script>


                   Please keep in mind I did not fully test it while writing my reply.

                   Please have a developer to validate before posting to production.
                    
              • Re: Dynamic Content Based on URL Parameters
                Jenn DiMaria
                Thanks so much for all your help, everyone!  I got excited when I saw on the page that it could be done in Marketo and it seemed like you wouldn't need javascript - but alas, haha.  This was helpful and it'll be interesting to see what happens with these campaigns.