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 :
<!-- Google Code for Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 010101010101;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "SomeRandomLabel";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/971631980/?label=MCwlCLTErgoQ7NqnzwM&guid=ON&script=0"/>
</div>
</noscript>
After reading a lot of questions here ( Like this ) , and also on the web, I have found some codes and hacked them into this :
<script type="text/javascript">
/* <![CDATA[ */
function Tracking_conversion_custom(){
var img = document.createElement("img");
var goalId = 010101010101;
var randomNum = new Date().getMilliseconds();
var value = 0;
var label = "SomeRandomLabel";
var url = encodeURI(location.href);
var trackUrl = "http://www.googleadservices.com/pagead/conversion/"+goalId+"/?random="+randomNum+"&value="+value+"&label="+label+"&guid=ON&script=0&url="+url;
img.src = trackUrl;
document.body.appendChild(img);
}
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
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 )