June 4, 2013

How to Make Responsive Landing Pages in Marketo, for Web Developers

By Edward Unthank

 

Edit: I no longer believe that !important stylings are the best way to achieve the responsive LP goal. Instead, create your own DOM with this DoubleDiv Method. There’s a more detailed description of how to create responsive Marketo pages here, along with free Marketo LP templates:

Screen Shot 2015-02-18 at 10.01.04 AM

 

Written for web developers. People who already know some coding best practices, but just don’t know the intricacies of how Marketo’s WYSIWYG editor works quite yet.

Starting with making the responsive Marketo landing page template:

Delete all of the CSS in the landing page template. Everything you can manage. There will be some CSS still called in a PHP line, but that’s unavoidable because the same PHP echo has necessary Marketo tracking functionality.

Do your external CSS and JS calls in the head. And extra JS right before the closing of the body tag, as usual.

Don't worry, this is supposed to happen. And by "supposed to happen," I mean "we did it on purpose."

 

You can use tokens in the landing page template! This is recommended for the super advanced landing page design. Two examples:

{{my.landingPageCSS}} = <style link=stylesheet href=”http://etumos.com/mkto/style.css”>
{{my.landingPageCSS}} = <style>.PO{position:relative!important;}</style>

.banner{background-image:url({{my.landingPageBannerURL:default=http://etumos.com/mkto/banner.png}})}

The token my.landingPageCSS can call external CSS or have the styling within itself. This allows some flexibility within the template. Without a default value, if there is no token set, this line will disappear. The example of my.landingPageBannerURL allows for easily changing background pictures of features, which can be useful if you’re looking to have the highlighted image in the CSS as opposed to the landing page itself. A possible use for this might be the new SVG clown car method for responsive images.

 

Making the Marketo responsive landing page in the editor:

Marketo editor and preview doesn’t call CSS or JS. These are only applied in the approved page.

The order in which you create elements is the order in which they appear in the DOM. Mind the order appropriately for proper order and floating.

The name of the element is included as its container div’s class. Spaces are translated into underscores, so you can only have one class name per element.

Any positioning styling that you’re looking to do will have to override the normal CSS hierarchy, so be prepared for some !important class stylings.

Segmentation is possible so long as all of the elements are named appropriately as classes and the element creation order is respected for the DOM.

That’s the basic knowledge that you need to know in order to create responsive Marketo LPs! The DOM is based on what order you created elements, the name of the element becomes the containing div’s class, and you can add your absolute positioning styling up in the head, or make tokens so you don’t have to edit the actual landing page template after the first time!