SOLVED

Re: Open a new tab after form submission

Go to solution
Anonymous
Not applicable

Open a new tab after form submission

Is there any way to open a new tab with a form submission?  We have specific needs to track conversion that use a few different ways.  I know the Marketo conversion works if we stay on the same page, but a company we work with requires a different page to open to track.  Instead of forcing that person to go to a different website or refresh the current website, we'd like to open a new tab with the different website, enabling our partners to track conversion but keeping the user on the same page.  Can this be done?  If so, how?
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Open a new tab after form submission

Hi Kymberlee,

Quick update. The script below can be added as an HTML element in Marketo Landing Page, similar to my previous suggestion. However, this one is better because it will only open the new tab/window if no error messages are displayed when the form is validated for things like required fields or valid email address (which are built into many landing page templates):

<script type="text/javascript">
$jQ('#mktFrmSubmit').click(function() {
var mktErrorMsgContent = $jQ('.mktFormMsg').html();
if (mktErrorMsgContent != 'This field is required') {
window.open('http://www.marketo.com'); //<-- Change this to your url
}
});
</script>

I hope this addresses your objective.

Reade Triolo

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

Re: Open a new tab after form submission

There is no way to do this with existing functionality in Marketo, but possibly some Javascript code on the page could open the follow-up page in another tab.
Anonymous
Not applicable

Re: Open a new tab after form submission

I found the java script for opening in a new window. Is there a script for opening in a new tab?
Anonymous
Not applicable

Re: Open a new tab after form submission

I am not aware of any Javascript existing to do this, it would have to be written.
Anonymous
Not applicable

Re: Open a new tab after form submission

Hi Kymberlee,

Opening a new tab versus a new window is controlled by the client browser. By default, most current browsers will open a new window as a new tab, unless the user has changed the default behavior for the JavaScript window.open function.

You can use JavaScript to open a new tab upon submission. Add an HTML element to your landing page and copy the following code to that element:

<script type="text/javascript">
     $jQ('#mktFrmSubmit').click(function() {
     //alert('You clicked Submit!');
     window.open('http://www.marketo.com'); //<-- Change this to your URL
});
</script>

NOTE: This code does not take into account whether the form was completed appropriately. 
Anonymous
Not applicable

Re: Open a new tab after form submission

Hi Kymberlee,

Quick update. The script below can be added as an HTML element in Marketo Landing Page, similar to my previous suggestion. However, this one is better because it will only open the new tab/window if no error messages are displayed when the form is validated for things like required fields or valid email address (which are built into many landing page templates):

<script type="text/javascript">
$jQ('#mktFrmSubmit').click(function() {
var mktErrorMsgContent = $jQ('.mktFormMsg').html();
if (mktErrorMsgContent != 'This field is required') {
window.open('http://www.marketo.com'); //<-- Change this to your url
}
});
</script>

I hope this addresses your objective.

Reade Triolo
Anonymous
Not applicable

Re: Open a new tab after form submission

Hi Reade - thanks for the answer!  Is there a specific place I should put this in the code?  I'm looking to be able to keep the user on the initial site while the other site opens in the backgroud.  Is there a way to implement the code so that I'm not directed to the new tab?
Anonymous
Not applicable

Re: Open a new tab after form submission

Hi Kymberlee, (love the spelling of you name BTW),

In the Marketo Landing Page editor, just drag an HTML element to any place on the page and paste the code. Because the code you will be using is enclosed with a <script ...> tag, it will not be visible on the page.

Opening the new page in the background while maintaining focus on the inital page is something that JavaScript CAN support. However, the capability to influence the focus tab/window can be overridden by the browser settings and bypass this JavaScript code. 

As time permits, I can take a look at augmenting the code example I provided to see if we can achieve your objective.

Reade Triolo
Anonymous
Not applicable

Re: Open a new tab after form submission

Hi Kymberlee,

I have been considering your objective from a purely tactical perspective. I did some research on this topic and I believe we are at the mercy of the browser configuration. It seems there is not an elegant way to accomplish your objective but you might consider finding a JavaScript developer to validate my conclusion.

That said, forgive my additional probing but I am wondering about the business objective of this requirement. I am also concerned about the user experience should you find a way to accomplish this behavior new window action. Opening new windows that are not focused typically has negative connotations and is frowned upon in many instances. A

As I revisited your use case in the original question, I am wondering if there is a better way to accomplish the business objective. I am imagining that the partner page has its own tracking capabilities and that by opening an additional page from a successful form submission, the partner can then know that the form was submitted successfully, which page it was submitted from and possibly some other stuff that might occur by that page being opened.

Can you help me better understand your business objective, apart from the tactical execution we have been discussing?

Reade Triolo

 

Anonymous
Not applicable

Re: Open a new tab after form submission

Hi Reade,

Thanks so much for all of your help.  This is not our ideal user experience, that's for sure. 

For our partners to properly track conversion using their tools, they need a new page to open so the conversion code can be tagged.  Right now our form exists in an iframe and so does the follow up form.  We tried putting their conversion code in the follow up form in the iframe but it's not giving them the information they need.

-Kym