Re: Form fill to page with Google Analytics code without a redirect

Robb_Barrett
Marketo Employee

Form fill to page with Google Analytics code without a redirect

Hi all -

I have a vendor that is requesting we have all of our Contact Us links lead to a distinct Thank You page so that we can have conversion tracking. HOWEVER, my goal is to stop directing to a new page so that we don't lose the view of the asset. For example, if you're watching a video and click "Contact Us" we don't want you to navigate away from the video.

To accomplish this I'm trying something out but I want to get some field thoughts on this to make sure I'm doing my due diligence.

How it works: On the page, the form is in a hidden DIV.  When you click the Contact Us button it displays the DIV, which contains the standard Forms code.

Then:

form.onSuccess(function() {

document.getElementById('contactUsPopUp').innerHTML = '<object type="text/html" data="Thank-You.html" ></object>';

setTimeout(function() {document.getElementById('contactUsPopUp').style.display='none';}, 5000);

return false;

});

(in case HTML isn't showing up:

form.onSuccess(function() {

document.getElementById('contactUsPopUp').innerHTML = '<object type="text/html" data="http://landing1.gehealthcare.com/AD-16-05-HIT-CCA_Thank-You.html" ></object>';

setTimeout(function() {document.getElementById('contactUsPopUp').style.display='none';}, 5000);

return false;

});

)

My thought is that this pulls the Thank You page into the div, which should pull the GA code as if the person had actually visited that page (looking for confirmation on this). The DIV then auto-closes.  Will Google Analytics still track this as a conversion?

My vendor isn't available yet to test so prior to putting them through testing is there anything I should be thinking about?

Robb Barrett
4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Form fill to page with Google Analytics code without a redirect

Ugh.  I mean, sometimes necessary, but ugh.

There's no real reason to use an OBJECT here (just depletes browser support a little).  Better with a hidden IFRAME.  But yes, it will work, and JS will execute inside the IFRAME. It doesn't need to be visible to the user. Just make sure you have that IFRAME be as lowkey as possible -- no Munchkin, no anything, except GA.

There's always a less clumsy & bandwidth-hungry way to do load a conversion pixel, like with a single GA hit. It's really bad that this is the way they want it.

Robb_Barrett
Marketo Employee

Re: Form fill to page with Google Analytics code without a redirect

They want to track hits to a LP and then form fill conversions.

Robb Barrett
SanfordWhiteman
Level 10 - Community Moderator

Re: Form fill to page with Google Analytics code without a redirect

If they require an actual pageview, then your approach (with IFRAME instead of OBJECT for widest compatibility) is all you've got.

(I wouldn't set innerHTML but use actual DOM methods to create the IFRAME. But that's an implementation detail.)

Robb_Barrett
Marketo Employee

Re: Form fill to page with Google Analytics code without a redirect

Thanks for the tip on DOM.  This was a quick and dirty approach and Object was the first thing that came to mind, along with just using the innerHTML.  I needed a proof of concept I could put together in a few minutes.

Robb Barrett