JavaScript to Fire AdWords Conversion Pixel on Form Submit
I found a clever piece of code on this site to fire the AdWords conversion pixel by creating the 1x1 image that Google gives you in their conversion setup.
I'm trying to adapt it to Marketo forms, but I can't seem to get the code working.
Here's what I have so far (with the conversion numbers/labels replaced):
<script type="text/javascript">
MktoForms2.whenReady(function(form){
form.onSuccess(function(){
function trackConv() {
var image = new Image(1,1);
image.src = "//www.googleadservices.com/pagead/conversion/XXXXXXXXXX/?label=XXXXXXXXXXXXX&guid=ON&script=0";
}
});
});
</script>
Any ideas why I'm not seeing any conversions in AdWords? I'm thinking it may be a script error as I'm new to JavaScript.