AnsweredAssumed Answered

Best way to add a script in a guided landing page

Question asked by e6615dd679b5dd0c3e60c20085706f392a9af2cb Champion on Dec 15, 2016
Latest reply on Dec 17, 2016 by e6615dd679b5dd0c3e60c20085706f392a9af2cb

Guided landing pages do not make it easy to add a script, for instance if you need to add some Google adwords or any other type of conversion code "on the fly".

 

Here are the methods I have found so far, with some pros-and cons.

 

MethodUsing
ProsCons
Add the script to the LP template with some variables to activate it and set parameters
  • Variables
  • Robust
  • Not flexible at all (if you want another script, you need a different LP template)
Add the script to a web file (stored in Marketo if necessary), then add a variable to the LP template and implement a <script src="${scripturl}"> within the template.
  • Variables
  • Quite robust
  • Flexible
  • Can be set at asset level
  • Only 1 script possible
  • No <noscript> version of the tag. But is this an issue? IF JS does not work on the browser, the Marketo form will not display anyway.
Add the script to a web file (stored in Marketo if necessary), then add a token to the LP template and implement a <script src="{{my.token}}"> within the template.
  • Tokens
  • Quite robust
  • Flexible
  • Can only be set at program token
Add a snippet container at right place in the LP template, Create a snippet that includes the script (one snippet per different script or series of scripts) and let the users add the snippet script to the LP as needed
  • Snippet
  • Safe as you can control tightly who can create/edit snippets
  • Very flexible (our tests show you can freely add some JS scripts to snippets)
  • Can be set at asset level
  • Can also contain the <noscript> version of the tag
  • The script and <noscript> will necessarily be renderred within a <DIV>, since the mktoSnippet takes a div. But is this a problem?
Create a variable on the LP, set it to "allowHTML=true" and let the user paste the script into it
  • Variables
  • Very flexible
  • Asset level
  • Error prone
Add one or more scripts to web files (stored in Marketo if necessary), then add a variable to the LP template. Have the user to add the URI of the web files in this variable. Then have a JS code that injects the code from the files in the landing page at runtime.
  • Variables
  • Very flexible
  • Enable many scripts if necessary
  • Can be made to control the source of the files and therefore very secure
  • Can be set at asset level
  • Is there a security issue with JS code injection? In this case, will need a secure server on which posting the injected files
Add one or more scripts to web files (stored in Marketo if necessary), then add a program / folder token. Have the user to add the URI of the web files in this token. Then have a JS code that injects the code from the files in the landing page at runtime
  • Tokens
  • Very flexible
  • Enable many scripts if necessary
  • Can be made to control the source of the files and therefore very secure
  • Cannot be set at asset level
  • Is there a security issue with JS code injection? In this case, will need a secure server on which posting the injected files

 

 

I would love to read some feedbacks, ideas and experience. We will run some tests on the best ideas and summarize it here.

 

-Greg

Outcomes