Select Page

When using a third party checkout google tag manager didn’t want to work for me.

It worked totally fine on magento’s native checkout page, but not on a this party checkout.

I’m using Udevix GTM extension with Nordic Web Team’s Klarna Checkout extension

My Solution:

In file “app/design/frontend/base/default/layout/google_tag_manager.xml” find this:

<checkout_onepage_success>
	<reference name="after_body_start">
		<block type="udevix_google_tag_manager/transactions" name="google_tag_manager_transactions"
		       as="gtm_transactions" before="google_tag_manager_code"
		       template="udevix/google_tag_manager/transactions.phtml"/>
	</reference>
	<reference name="google_tag_manager_remarketing">
		<action method="setPageType">
			<type>purchase</type>
		</action>
	</reference>
/checkout_onepage_success>

In file “app/design/frontend/base/default/layout/nwt/kco.xml”

Add this:

<reference name="after_body_start">
	<block type="udevix_google_tag_manager/transactions" name="google_tag_manager_transactions"
	       as="gtm_transactions" before="google_tag_manager_code"
	       template="udevix/google_tag_manager/transactions.phtml"/>
</reference>
<reference name="google_tag_manager_remarketing">
	<action method="setPageType">
		<type>purchase</type>
	</action>
</reference>

Before

</nwtkco_checkout_thankyou>

So you get this:

<nwtkco_checkout_thankyou>
    <label>Klarna Checkout Success Page</label>

    <remove name="right" />
    <remove name="left" />
    <!--<remove name="content" />-->

    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
        <action method="addBodyClass"><class>body-klarna-checkout</class></action>
    </reference>

    <reference name="head">
        <action method="addItem"><type>skin_css</type><name>nwt/kco/main.css</name><params/></action>
    </reference>

    <!-- use own ga -->
    <!--
    <reference name="google_analytics">
        <action method="setTemplate"><template>nwt/kco/ga.phtml</template></action>
    </reference>
    -->

    <reference name="content">
        <action method="unsetChildren"></action>
        <block type="core/template" name="nwtkco_messages" template="nwt/kco/messages.phtml"/>
        <block type="nwtkco/thankyou" name="nwtkco_kco" template="nwt/kco/success.phtml">
            <block type="nwtkco/klarna"  name="klarnacheckout" as="klarnacheckout" template="nwt/kco/klarna.phtml" />
        </block>
    </reference>

    <reference name="after_body_start">
        <block type="udevix_google_tag_manager/transactions" name="google_tag_manager_transactions"
               as="gtm_transactions" before="google_tag_manager_code"
               template="udevix/google_tag_manager/transactions.phtml"/>
    </reference>
    <reference name="google_tag_manager_remarketing">
        <action method="setPageType">
            <type>purchase</type>
        </action>
    </reference>

</nwtkco_checkout_thankyou>

And GTN datalayer should work and be inserted before GTM script loads.