Google Conversion Tracking & Receipt Code in 2.0

RyanJTRyanJT Member
in Help edited September 2014
I recently upgraded to 2.0. I downloaded the Google conversion tracking code and I'm not sure where to paste it in my receipt template. Has anyone done this? The only docs I've found are for older versions. Thanks!
Comments
  • fc_adamfc_adam FoxyCart Team
    @RyanJT,

    Could you confirm for us the exact tracking code you're needing to insert? I want to make sure I'm on the same page as to what you're working with. Feel free to whisper if it's private.
  • Hi Adam, thanks for the reply. It is:

    <!-- Google Code for BuySmoothieCleanse Conversion Page -->
    <script type="text/javascript">
    /* <![CDATA[ */
    var google_conversion_id = 99544####;
    var google_conversion_language = "en";
    var google_conversion_format = "3";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "6mLPCJPZqFYQlZX####";
    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/99544####/?label=6mLPCJPZqFYQlZX####&guid=ON&script=0"/>
    </div>
    </noscript>

    I put in # to hide some of the characters.
  • fc_adamfc_adam FoxyCart Team
    @RyanJT,

    Great - thanks for confirming that. You'll want to place that in the "footer" section of the "inject custom code" option in your stores configuration page in the administration. You'll also want to wrap it in some Twig code to make sure it only displays on the first load of the checkout, like this:
    {% if first_receipt_display %}
    <!-- Google Code for BuySmoothieCleanse Conversion Page -->
    <script type="text/javascript">
    /* <![CDATA[ */
    var google_conversion_id = 99544####;
    var google_conversion_language = "en";
    var google_conversion_format = "3";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "6mLPCJPZqFYQlZX####";
    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/99544####/?label=6mLPCJPZqFYQlZX####&guid=ON&script=0"/>
    </div>
    </noscript>
    {% endif %}
    
Sign In or Register to comment.