1

Im adding this to my Local.xml and it just kills my footer. I want to add my analytics code to the head of just my success checkout page. What am I missing? Wrong update handle?

<checkout_onepage_success>
    <reference name="head">
        <block type="core/text" name="google_tracking" as="google_tracking">
            <action method="setText">
                <text><![CDATA[ <!-- Google Code for Purchases Conversion Page -->
                        <script type="text/javascript">
                        /* <![CDATA[ */
                        var google_conversion_id = xxxxxx;
                        var google_conversion_language = "en";
                        var google_conversion_format = "2";
                        var google_conversion_color = "ffffff";
                        var google_conversion_label = "xxxxxxx";
                        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/xxxxxx/?label=xxxxxxxQwonbyAM&amp;guid=ON&amp;script=0"/>
                        </div>
                        </noscript>]]>
                </text>
            </action>
        </block>
    </reference>
</checkout_onepage_success>
1
  • Why not just add it to the success.phtml? Commented Apr 9, 2015 at 7:04

1 Answer 1

2

Try removing /* <![CDATA[ */. Take a look at Is there a way to escape a CDATA end token in xml?

<block type="core/text" name="google_tracking" as="google_tracking">
    <action method="setText">
        <text>
            <![CDATA[
            <script type="text/javascript">
                    var google_conversion_id = xxxxxx;
                    var google_conversion_language = "en";
                    var google_conversion_format = "2";
                    var google_conversion_color = "ffffff";
                    var google_conversion_label = "xxxxxxx";
                    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/xxxxxx/?label=xxxxxxxQwonbyAM&amp;guid=ON&amp;script=0"/>
                    </div>
                    </noscript>
            ]]>
        </text>
    </action>
</block>

Also take a look at Magento FacebookRemarketingJs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.