• mscwebmaster

    (@theresajennings2011)


    I’m going to start a new thread, since the other one is marked as resolved, and it’s not resolved (I hijacked a thread – sorry). I know next to nothing about JavaScript.

    This is for Google Adwords, not Google Analytics, so the syntax of the tracking url is different. I do not want thank-you pages. I want to show a conversion in Adwords on successful submission.

    I have a site with 4 or 5 different forms, each on their own page.

    I’m just doing one form right now until I get it right.

    Here’s the Google Adwords conversion code for the Contact page:

    <!-- Google Code for Contact Conversion Page -->
    <script type="text/javascript">
    /* <![CDATA[ */
    var google_conversion_id = 1234567;
    var google_conversion_language = "en";
    var google_conversion_format = "3";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "alcqCKnt4wUQz8aqyQM";
    var google_conversion_value = 0;
    /* ]]> */
    </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/1234567/?value=0&label=alcqCKnt4wUQz8aqyQM&guid=ON&script=0"/>
    </div>
    </noscript>

    On another thread it was suggested that I put all the functions for the different forms into one external js file, then call the js file in the header.php.

    I’m using a child theme, so I’ve created a tracking.js file to put the functions for each form in and put that and a copy of the header.php form into the child theme folder.

    At the bottom of the header.php in the child theme I’ve included:

    <?php include 'tracking.js'; ?>

    In the tracking.js file, I’ve put this code:

    function Contact(){
    var google_conversion_id = 959095631;
    var google_conversion_language = "en";
    var google_conversion_format = "3";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "alcqCKnt4wUQz8aqyQM";
    var google_conversion_value = 0;
    
    var trackUrl = "//www.googleadservices.com/pagead/conversion/959095631/?value=0&label=alcqCKnt4wUQz8aqyQM&guid=ON&script=0"
    }

    In the “Additional Settings” part of the Contact form, I’ve put in:

    on_sent_ok: "Contact();"

    And when I view the Contact page, I get this right below the navigation:

    function Contact(){ var google_conversion_id = 1234567; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "alcqCKnt4wUQz8aqyQM"; var google_conversion_value = 0; var trackUrl = "//www.googleadservices.com/pagead/conversion/1234567/?value=0&label=alcqCKnt4wUQz8aqyQM&guid=ON&script=0" }

    So I’ve done something wrong, and I don’t know enough JavaScript to tell what I’ve done wrong.

    Can anyone shed some light on this, please? It’s making me crazed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Did you get to the bottom of this? I’ve read so many pages about this issue with many conflicting suggestions. Your descriptions are the best I’ve seen of the problem on this forum but noticed that on each thread you’ve not had any success.

    Did you give up in the end or did you find a a solution outside of this WordPress forum?

    Thread Starter mscwebmaster

    (@theresajennings2011)

    I’m using Contact Form 7, and I put the part between the divs

    <div style="display:inline;">
    <img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/1234567/?value=0&label=alcqCKnt4wUQz8aqyQM&guid=ON&script=0"/>
    </div>

    in the first field under “Messages” (“#Sender’s message was sent successfully) immediately after the text in that box.

    Thank you for your kind comment. I posted a complicated 3 or 4 paragraph question on a WP group, and received the thoughtful TLDR (Too Long, Didn’t Read) comment. Unfortunately, most coding questions don’t fit into 140 characters, and they have medication now for people’s attention spans that are that short. You, on the other hand, were very sweet.

    Thread Starter mscwebmaster

    (@theresajennings2011)

    I’m responding to the question posted here – a thread I started here. Dave333 asked what the resolution was. I gave it to him.

    You are welcome to move the thread there. Since it said at the question title for the thread started 2 months ago that it was Contact 7, and no one has mentioned it until now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Contact Form 7 Google Adwords Conversions multiple forms’ is closed to new replies.