SOLVED

Re: Tracking Scripts inside Embedded Marketo Forms

Go to solution
Christina_Dearm
Level 2

Tracking Scripts inside Embedded Marketo Forms

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.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Tracking Scripts inside Embedded Marketo Forms

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.

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Tracking Scripts inside Embedded Marketo Forms

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
Level 2

Re: Tracking Scripts inside Embedded Marketo Forms

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