Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gudmund Berggren 7 posts 27 karma points
    Aug 29, 2011 @ 22:20
    Gudmund Berggren
    0

    Google AdWords Conversion without loading a thankyou page

    Hi!

    I would like to make Contour execute the Google conversion tracking code when a form has been submitted.

    The thing that makes this a bit complicated is that I do not want a separate thank you page. So far so good, but the challenge is where to put the conversion code.

    Can anyone give me a hint?

    Parts of the code that shall be executed is shown below and since no page is loaded/reloaded I am a bit lost.

    <!-- Google Code for .. Conversion Page -->
    <script type="text/javascript">
    /* <![CDATA[ */
    var google_conversion_id = xxxx ;
    var google_conversion_language = "sv";
    var google_conversion_format = "2";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "xcxc";
    var google_conversion_value = 0;
    if (100) {
    google_conversion_value = 100;
    }
    /* ]]> */
    </script>
    <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
    </script>
    <noscript>
    <div style="display:inline;">
    <img height="1" width="1" style="border-style:none;" alt="" </div>
    </noscript>

  • Comment author was deleted

    Aug 30, 2011 @ 09:23

    Well binding it to the form submit button would be the obvious option.

     

  • Gudmund Berggren 7 posts 27 karma points
    Aug 30, 2011 @ 13:48
    Gudmund Berggren
    0

    Hi,

    Could you indicate in which file this modification can be done ?

    Best Regards

    Gudmund

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Oct 07, 2011 @ 11:26
    Jeavon Leopold
    0

    It's a bit tricky, but you can do it by using jQuery to append a Iframe with a src loading a page containing the Conversion code.

    We use a altTemplate to keep it neat, call your template something like iframetracking

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
    <head>
    </head>
    <body>
    <!-- Google Code for .. Conversion Page --> 
    <script type="text/javascript"> 
    /* <![CDATA[ */ 
    var google_conversion_id = xxxx ; 
    var google_conversion_language = "sv"; 
    var google_conversion_format = "2"; 
    var google_conversion_color = "ffffff"; 
    var google_conversion_label = "xcxc"; 
    var google_conversion_value = 0; 
    if (100) { 
    google_conversion_value = 100; 

    /* ]]> */ 
    </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="" </div> 
    </noscript>
    </body>
    </html>
    </asp:Content>

    Then in the settings of the form in the "Message on submit" box add the following:

    <script type="text/javascript">
    $('<iframe src="'+document.location.href+'?altTemplate=iframetracking" width="0px" height="0px"></iframe>').appendTo($('body'));  
    </script> 

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Oct 07, 2011 @ 11:32
    Jeavon Leopold
    0

    Forgot to mention you need to have jQuery included in the head of your page.

     

  • Gudmund Berggren 7 posts 27 karma points
    Oct 07, 2011 @ 18:41
    Gudmund Berggren
    0

    Hi!

    Great. Thank you very much ;-)

    Best Regards

    Gudmund

  • Pushpendra Singh 61 posts 116 karma points
    May 01, 2014 @ 06:04
    Pushpendra Singh
    0

    Hi All,

    You are having any  idea/implementation about AdWords like Google in umbraco site.

    Regards,

    Pushpendra Singh 

Please Sign in or register to post replies

Write your reply to:

Draft