Getting Marketo Landing Page JavaScript To Work

January 27th, 2014 - Posted by Steve Marks to (X)HTML / CSS, Javascript / jQuery, Web Development.

I was recently tasked with building some landing pages in Marketo for a client. They chose Marketo so that they could track conversions and record submissions from the embedded form.

I’d built landing pages in the past with no real problems, that was until now. In summary, on my landing page I had a small jQuery countdown timer that would count down the hours, minutes and seconds to a particular event.

The jQuery code was in a separate JavaScript file hosted elsewhere on one of my domains and was included like so:

<script src=""></script>

When building the landing page template in HTML, it worked absolutely fine and the countdown clock ticked down the seconds.

The Problem

The default landing page template in Marketo already has jQuery included so the only JavaScript file I needed to include was the one that was hosted on my own domain.

When I moved the HTML into a Marketo landing page template and previewed the page, the jQuery just didn’t fire at all. The countdown clock wasn’t showing at all and, when I viewed the console, I could see an error regarding the JavaScript not being able to be initialised.

I needed to figure out why the HTML would work fine outside of Marketo, but then stop as soon as it’s added into a landing page.

Finding a Solution

The first thing I noticed was that when editing pages within Marketo, the pages are all served over HTTPS. From previous experience I knew that loading files from a HTTP source over HTTPS would result in security warnings.

As a result, I changed the code that included my JavaScript to be as follows:

<script src=""></script>

After changing the ‘src‘ attribute to begin with ‘https‘ I tried again, alas still to no avail.

To find out if this JavaScript file could actually be loaded over HTTPS, I decided to visit the URL ( direct from within my browser. The result was an SSL warning like so:

Chrome SSL Certificate Warning
If I wasn’t able to load the JavaScript file direct, there was a high chance that the Marketo landing page wouldn’t either.

The Solutions

Based on my findings above, I concluded that there are two solutions to fixing this problem:

1) Purchase and enable an SSL certificate for the domain where the JavaScript file is being hosted.


2) Take the contents of the JavaScript file being included and paste the contents directly into the landing page HTML.

In my scenario, because the situation was quite a rare one, I went for the second option and placed the JS code directly within the HTML. Once I’d done this the jQuery countdown time began to work immediately as expected.

This entry was posted on Monday, January 27th, 2014 at 8:41 pm by +Steve Marks and is filed under (X)HTML / CSS, Javascript / jQuery, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.

Fear not, we won't publish this

Comments (0)

No comments have been left yet. Be the first