dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: google conversion

  1. #1
    Join Date
    Oct 2007
    Posts
    1

    google conversion

    hi,

    we use google adwords to market our site.
    we have set the conversion tracking code on the thank you page so when the web form is submited we can track the % on conversions which is great.

    my quesion is

    say i recive 20 replys and i know by using adwords that 10 have come via pay per click. how can i tell which of the 20 came through google?

    i was thinking if i could populate a hidden feild on the form with value="google" when the Google Code for Lead Conversion was activated i could tell that way.

    could any one help me out on this.

    the code below is the Google Code for Lead Conversion wich is added to the tahnk you page

    <!-- Google Code for Lead Conversion Page -->
    <script language="JavaScript" type="text/javascript">
    <!--
    var google_conversion_id = 0000000000;
    var google_conversion_language = "en_GB";
    var google_conversion_format = "1";
    var google_conversion_color = "666666";
    if (1) {
    var google_conversion_value = 1;
    }
    var google_conversion_label = "Lead";
    //-->
    </script>
    <script language="JavaScript" src="http://www.googleadservices.com/pagead/conversion.js">
    </script>
    <noscript>
    <img height=1 width=1 border=0
    src="http://www.googleadservices.com/pagead/conversion/0000000000/?value=1&label=Lead&script=0">
    </noscript>


    here is the code that is in the js file that google link to


    function google_get_filename() {
    var validLangs = Array("da", "de", "en_US", "en_GB", "es", "fi",
    "fr", "it", "ja", "ko", "nl", "no", "pt_BR", "sv",
    "zh_CN", "zh_TW");
    var lang = window.google_conversion_language;
    if (lang) {
    for (var i=0; i < validLangs.length; i++) {
    if (validLangs[i] == lang) return lang + ".html";
    }
    }
    return "en_US.html";
    }

    function google_language_code() {
    var lang = window.google_conversion_language;
    if (!lang) return "";
    if (2 == lang.length) return "&hl=" + escape(lang);
    if (5 == lang.length) {
    return ("&hl=" + escape(lang.substring(0,2)) +
    "&gl=" + escape(lang.substring(3,5)));
    }
    return "";
    }

    function google_handle_conversion() {
    var w = window;

    if (w.google_conversion_snippets) {
    w.google_conversion_snippets = w.google_conversion_snippets + 1;
    } else {
    w.google_conversion_snippets = 1;
    }

    if (w.google_conversion_id) {
    var proto = w.location.protocol.toLowerCase();
    if ('http:' != proto && 'https:' != proto) {
    proto = 'http:';
    }
    var path = "/?";
    if (w.google_conversion_type == 'landing') {
    path = "/extclk?";
    }
    var url = proto +
    "//www.googleadservices.com/pagead/conversion/" +
    escape(w.google_conversion_id) + path +
    "random=" + (new Date()).getTime();
    if (w.google_conversion_value) {
    url = url + "&value=" + escape(w.google_conversion_value);
    }
    if (w.google_conversion_label) {
    url = url + "&label=" + escape(w.google_conversion_label);
    }
    if (w.google_conversion_ad) {
    url = url + "&gad=" + w.google_conversion_ad;
    }
    if (w.google_conversion_key) {
    url = url + "&gkw=" + w.google_conversion_key;
    }
    if (w.google_conversion_mtc) {
    url = url + "&gmtc=" + w.google_conversion_mtc;
    }
    if (w.google_conversion_raw) {
    url = url + "&graw=" + w.google_conversion_raw;
    }
    if (w.google_conversion_domain) {
    url = url + "&dom=" + w.google_conversion_domain;
    }
    url = url + google_language_code();
    var link = proto + "//services.google.com/sitestats/" +
    google_get_filename() + "?cid=" + escape(w.google_conversion_id);

    if (w.google_conversion_format == 0) {
    document.write('<a href="' + link + '" target="_blank">' +
    ' <img border=0 height=27 width=135 src="'
    + url + '"></a>');
    } else if (w.google_conversion_snippets > 1) {
    url = url + '&num=' + w.google_conversion_snippets;
    document.write('<i' + 'mg height="1" width="1" border="0" ' +
    'src="' + url + '" />');
    } else {
    url = url + '&fmt=' + w.google_conversion_format;
    if (w.google_conversion_color) {
    url = url + '&bg=' + w.google_conversion_color;
    }
    var width = 300;
    var height = 13;
    if (w.google_conversion_format == 2) {
    width = 200;
    height = 26;
    }
    document.write('<ifr' + 'ame' +
    ' name="google_conversion_frame"' +
    ' width="' + width + '"' +
    ' height="' + height + '"' +
    ' src="' + url + '"' +
    ' frameborder="0"' +
    ' marginwidth="0"' +
    ' marginheight="0"' +
    ' vspace="0"' +
    ' hspace="0"' +
    ' allowtransparency="true"' +
    ' scrolling="no">');
    document.write('<i' + 'mg height="1" width="1" border="0" ' +
    'src="' + url + '&ifr' + 'ame=0"' +
    ' />');
    document.write('</ifr' + 'ame>');
    }
    }

    w.google_conversion_id = null;
    w.google_conversion_value = null;
    w.google_conversion_label = null;
    w.google_conversion_language = null;
    w.google_conversion_format = null;
    w.google_conversion_color = null;
    }

    if (window.google_conversion_format == null) {
    google_conversion_format = 0;
    } else if (window.google_conversion_format > 2 ||
    window.google_conversion_format < 0 ) {
    google_conversion_format = 1;
    }


    function google_get_param(url, param) {
    var i;
    var val;
    if ((i = url.indexOf("?" + param + "=")) > -1 ||
    (i = url.indexOf("?" + param.toUpperCase() + "=")) > -1 ||
    (i = url.indexOf("&" + param + "=")) > -1 ||
    (i = url.indexOf("&" + param.toUpperCase() + "=")) > -1) {
    val = url.substring(i + param.length + 2, url.length);
    if ((i = val.indexOf("&")) > -1) {
    val = val.substring(0, i);
    }
    }
    return val;
    }

    function google_get_domain(url) {
    if (url) {
    domain = url.match(".?://(www\.)?([^/:]+)");
    if (domain && domain.length >= 3) {
    return domain[2] ? domain[2] : '';
    }
    }
    return "";
    }

    if (window.google_conversion_type == 'landing') {
    var url = document.location + "";
    google_conversion_domain = document.domain + "";
    var ref = google_get_domain(document.referrer);
    if (ref && (ref.indexOf(google_conversion_domain) > -1 ||
    google_conversion_domain.indexOf(ref) > -1)) {
    url = "";
    }
    google_conversion_ad = google_get_param(url, "gad");
    if (window.google_conversion_ad) {
    (google_conversion_key = google_get_param(url, "gkw")) ||
    (google_conversion_key = google_get_param(url, "ovkey"));
    google_conversion_mtc = google_get_param(url, "ovmtc");
    google_conversion_raw = google_get_param(url, "ovraw");
    }
    }

    google_handle_conversion();

    Thank you

  2. #2
    Join Date
    Jul 2005
    Location
    USA
    Posts
    912
    You should really setup a separate page on your site that only Google banners link to and then that page will redirect to your home page. That way, you can view regular usage stats for hits on that page

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles