Tracking Scripts inside Embedded Marketo Forms | Community
Skip to main content
Christina_Dearm
New Participant
June 5, 2020
Solved

Tracking Scripts inside Embedded Marketo Forms

  • June 5, 2020
  • 1 reply
  • 2182 views

We want to be able to have the form fills use a jstag.send, GTM, and Lytics script that we have on hand for tracking. My understanding from docs, support, and my own experience is that any tracking script is supposed to live on the page the form is embedded on.

 

I was asked if there is was any way for me to place this script directly into the Marketo form itself so we can bypass our long Dev team wait to place anything on the page we embed the Marketo form on.


Has anyone else found some average user (non-developer) way to do this? I know that I cannot put it in the custom CSS area since that is wrapped in <style> tags.

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

The answer to whether you can embed custom JS behaviors in the form itself is firmly Yes. But I wouldn't say you have no coding effort to worry about.

 

In the blog post HOWTO: Add Forms 2.0 JS behaviors inside a Rich Text Area I show how to safely do just that. 

 

But if you're talking about JS that needs to run, for the obvious example, on a successful form submission, you can't just throw it in the Rich Text. That'll load any function so that it can be called. 

 

But you still have to only call the function conditionally using the Forms 2.0 API's onSuccess event. A GTM tag that's supposed to fire on success needs to be coordinated with the default success action using the GTM eventCallback feature.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
June 6, 2020

The answer to whether you can embed custom JS behaviors in the form itself is firmly Yes. But I wouldn't say you have no coding effort to worry about.

 

In the blog post HOWTO: Add Forms 2.0 JS behaviors inside a Rich Text Area I show how to safely do just that. 

 

But if you're talking about JS that needs to run, for the obvious example, on a successful form submission, you can't just throw it in the Rich Text. That'll load any function so that it can be called. 

 

But you still have to only call the function conditionally using the Forms 2.0 API's onSuccess event. A GTM tag that's supposed to fire on success needs to be coordinated with the default success action using the GTM eventCallback feature.

Christina_Dearm
New Participant
June 8, 2020

Thanks very much Sanford. As always you have a solution for every problem 🙂