Google Adwords conversion Tracking event - single page
I am very unfamiliar with all the google anaylytics / adwords / conversion etc ..
I have a client site ( wordpress ) , which is actually a single page , where it has a contact form at the bottom ( built with contact form 7 if one must know ).
The contact form is linked with an anchor ( # ) only. it is not a separate page.
The code for implementing is :
After reading a lot of questions here ( Like this ) , and also on the web, I have found some codes and hacked them into this :
My Questions are :
1 - The Tracking_conversion_custom() is invoked upon sending the form, but since I have a single page , will var url = encodeURI(location.href); work as expected as far as the google adwords tracking concern ? ( remember - it is an anchor only )
2 - In all the codes I have seen, the some vars are missing ( like var google_remarketing_only = false;, or google_conversion_format) - are they neglectable ? If not - how to add them ?
( Similar question here :Adding Google Conversion code to WordPress Contact Form 7 )
The encoded URL will be fine. Note that the label and goalID values will need to be the correct values from AdWords - label is now optional though so if one isn't provided in AdWords you'll need to remove it from this script (dont just pass garbage as that may lead to bad tracking)
However, this said if I were you rather than re-inventing the wheel and rolling my own code, I would just use the official Google tag that was designed specifically for this sort of usage:
That page explains what you need to do - it is coming from a remarketing perspective, but the conversion tag and the remarketing tag are basically the same thing (that is what the "google_remarketing_only" true/false is about - you'll want it to be "false" as this is conversion tracking).
So you'll want something like this, then just call google_trackConversion() whenever the form gets submitted - no messing about with encoding etc this way:
Hope that helps.