Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Google Adwords integration JavaScript code fixed in Web Store 3.2.6

Gabriel Guzman edited this page Apr 15, 2015 · 1 revision

Web Store views contain JavaScript code template for Google Adwords integration. However, there was a syntax error (missing semi-colons) in the code snippet that was causing errors when Adwords integration was enabled and preventing tracking conversion data from being submitted to Google. Self-hosted customers with theme copies need to manually edit one of the following files depending on which theme they have copied:

For Brooklyn 2014
themes/brooklyn2014copy/views/checkout/_googleconversion.php

For other themes
themes/brooklyncopy/views/cart/_googleconversion.php (using brooklyn as an example. Replace it with the name of the theme copy)

Before the fix:

<?php if (_xls_get_conf('GOOGLE_ADWORDS','') != ''): ?>
		<script type="text/javascript">

	    /* <![CDATA[ */
	    var google_conversion_id = <?= _xls_get_conf('GOOGLE_ADWORDS','0'); ?>
	    var google_conversion_language = "<?=  Yii::app()->language ?>";
	    var google_conversion_format = "3";
	    var google_conversion_color = "ffffff";
	    var google_conversion_label = "purchase";
	    var google_conversion_value = <?= $model->subtotal ?>
	    /* ]]> */
	</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=""
                 src="http://www.googleadservices.com/pagead/conversion/<?= _xls_get_conf('GOOGLE_ADWORDS','0'); ?>/?value=<?= $model->subtotal ?>&amp;label=purchase&amp;guid=ON&amp;script=0"/>
        </div>
    </noscript>

<?php endif;    

After fix:

<?php if (_xls_get_conf('GOOGLE_ADWORDS','') != ''): ?>
		<script type="text/javascript">

	    /* <![CDATA[ */
	    var google_conversion_id = <?= _xls_get_conf('GOOGLE_ADWORDS','0'); ?>;
	    var google_conversion_language = "<?=  Yii::app()->language ?>";
	    var google_conversion_format = "3";
	    var google_conversion_color = "ffffff";
	    var google_conversion_label = "purchase";
	    var google_conversion_value = <?= $model->subtotal ?>;
	    /* ]]> */
	</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=""
                 src="http://www.googleadservices.com/pagead/conversion/<?= _xls_get_conf('GOOGLE_ADWORDS','0'); ?>/?value=<?= $model->subtotal ?>&amp;label=purchase&amp;guid=ON&amp;script=0"/>
        </div>
    </noscript>

<?php endif;    
Clone this wiki locally