2.3K members online now
2.3K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
Guide Me

Issues tracking form submissions conversions with virtual pages

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi everyone, 


The thing is I have an iframe with a form in my web (using Pardot). After correctly submitting the form the whitepaper is sent via mail and there is no thank you page, so we are tracking the conversion with a virtual pageview (adding at the end of the url the parameter "?whitepaper=ok"

Here is the "thank you code":


<script type="text/javascript">
// <![CDATA[


var urlOrigin=document.referrer;
var param='rd';
var svalue = urlOrigin.match(new RegExp("[\?\&\&amp;]" + param + "=([^\&]*)(\&?)","i"));
var url= svalue ? svalue[1] : svalue;
var urlGA= url+'?whitepaper=ok';

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

ga('create', 'UA-XXXXX', '');
ga( 'send', 'pageview', urlGA );


// ]]>


The interesting thing is that in real time conversions it's working, but then i don't know why/how not every conversion remains as conversion (there are 25 conversions registered vs 160 registered in Pardot). I have checked Pardot and they are all actually real non-repeated people. I'm also seeing the data in a non-filtered view in GA.


FYI, I use GTM. By the way, one of the alternatives I have (even better than the one i'm using) is tracking the form submission as event, but Data Layer doesn't recognize the form id and Form classes.


Thanks, i'm becoming desperate!


PD: In the meanwhile i'm going to put the parameter "onBlur", but it's not ideal because we are going to have "rubbish" pageviews

1 Expert replyverified_user

Re: Issues tracking form submissions conversions with virtual pages

Top Contributor
# 2
Top Contributor

it has been awhile since I used Pardot but then I placed JS code (for GA tracking) in Pardot. That code got executed when Thank you message was displayed.

So if that still works you could just add
dataLayer.push({'event': 'event_name'});
In the same time you could push all the other info you want as dataLayer variables that you can catch in GTM

And then create custom event listener to listen event_name that fires your tag that sends the info to GA
(or use gtm.formSubmit and use built-in event listener but I don't know if that works)

Just from top of my head, no guarantees, most likely needs some iteration...
To make bad day worse, spend it wishing for the impossible

Antti Nylund, Google Analytics Top Contributor
Did my answer solve your issue? If yes, please mark it as the ‘Best Answer.’ Otherwise keep on asking.

Re: Issues tracking form submissions conversions with virtual pages

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
I realize this was a while ago, but I dealt with the same issue and this might also be an issue of cross-domain tracking.

I've had some success with modifying the ga() functions to look like this:
ga('create', 'UA-XXXXXXX-X', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', [‘’] );
ga('send', 'pageview');

And since you are using tag manager, you'll probably want to add your cname or as linked domains with in the universal analytics tag.

After this, the completion action should be logged more consistently.