Weird code at the bottom of my page!!!!

Tourist
29 0 3

Hi everyone,

I'm hoping somone can help me understand this wierd code that has appeared at the bottom of my page!?!?! ITs clearly from the google tag, however - I have looked at every part of the code and cant see why it is appearing! 

Thanks in advance for your help! 
Dan

< Code as it is in the theme.liquid >

<!-- Google Code for Remarketing Tag -->
<!--------------------------------------------------
Remarketing tags may not be associated with personally identifiable information or placed on pages related to sensitive categories. See more information and instructions on how to setup the tag on: http://google.com/ads/remarketingsetup
--------------------------------------------------->  
    
    
    {% if template == 'product' %}

<script type="text/javascript">// <![CDATA[

var google_tag_params = {

ecomm_prodid: 'shopify_GB_{{ product.id }}_{{ product.variants.first.id }}',

ecomm_pagetype: '{{ template }}',

ecomm_totalvalue: {{ product.price | money_without_currency }}

};

{% elsif template contains 'cart' %}

var google_tag_params = {

{% if cart.item_count > 1 %} 

ecomm_prodid: [{% for item in cart.items %}'shopify_GB_{{ item.product_id }}_{{ item.variant.id }}'{% if forloop.last != true %},{% endif %}{% endfor %}],

{% elsif cart.item_count == 1 %}

ecomm_prodid: {% for item in cart.items %}'shopify_GB_{{ item.product_id }}_{{ item.variant.id }}'{% endfor %},

{% else %}

ecomm_prodid: '',

{% endif %}

ecomm_pagetype: 'cart',

ecomm_totalvalue: {{ cart.total_price | money_without_currency }}

};

{% elsif template contains 'search' %}

var google_tag_params = {

ecomm_prodid: '',

ecomm_pagetype: 'searchresults',

ecomm_totalvalue: ''

};

{% elsif template contains 'index' %}

var google_tag_params = {

ecomm_prodid: '',

ecomm_pagetype: 'home',

ecomm_totalvalue: ''

};

{% else %}

var google_tag_params = {

ecomm_prodid: '',

ecomm_pagetype: 'other',

ecomm_totalvalue: ''

};

  {% endif %}

// ]]></script>

<script type="text/javascript">

/* <![CDATA[ */

var google_conversion_id = XXX;
var google_custom_params = window.google_tag_params;
var google_remarketing_only = true;

/* ]]> */

</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="//googleads.g.doubleclick.net/pagead/viewthroughconversion/XXX/?value=0&amp;guid=ON&amp;script=0"/>
</div>
</noscript> 

0 Likes
Tourist
29 0 3

The offending code! As it appears at the bottom of the footer on the homepage.

0 Likes
Shopify Partner
2536 31 566

Hi Daniel, 

at first glance, you should replace this:

{% if template == 'product' %}
<script type="text/javascript">// <![CDATA[

with this:

<script type="text/javascript">// <![CDATA[
   {% if template == 'product' %}

Otherwise you have a piece of javascrip without opening <script...> tag unless on the product page.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com! My post solved your problem? This is my Paypal too :)
0 Likes
Tourist
29 0 3

Tim! You hero thank you so much! That has done the trick! 

0 Likes