Skip to main content
July 1, 2015
Question

Can a Webhook be used to dynamically add JavaScript to a landing page?

  • July 1, 2015
  • 1 reply
  • 1788 views

I'm trying to figure out how to allow a Marketo customer to be able to call a service to grab some JavaScript and have it automatically added to a landing page hosted by Marketo. Ideas?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
July 1, 2015

"Grab some JavaScript" -- what do you mean by that?

A Marketo-hosted LP is subject to no more (and no less) restriction than any other webpage as far as including outside content.

That is, you can call cross-domain services if they feel like letting you do so (via CORS proper or via JSONP).

What exactly is the the "service" and is it really grabbing JavaScript, or JSON?

July 1, 2015

We were originally told that using a Webhook could leverage calling an external service. We would create a service that would pull the JavaScript snippet, but I wasn't sure if that were to work, how we would be able to insert it into the HTLM.

SanfordWhiteman
Level 10
July 1, 2015

Well, a webhook can update fields stored on a Lead or Company.

It's very, very unlikely that this how you should shove data into your webpages (though, in theory, it would work, since you can use tokens on an LP).  Is it always different data per lead?  Is there some specific reason you can't have JS in the LP itself call out to the external service?  It's much more efficient to call out from the client (JS) for the primary reason that you only have to do this for leads that actually hit your page.  If you use a webhook you have to run every potential lead through the 'hook even if only a handful of them end up visiting. That's very bad for your instance's performance.