I mess up facebook pixel code

New Member
2 0 0

I cant active my facebook pixel 1218217704994477. I think i mess up code in theme.liquid.

what can i do?

<!doctype html>
<html class="no-js">
<head>
 
<!-- Facebook Pixel Code -->
<script>
  !function(f,b,e,v,n,t,s)
  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
  n.callMethod.apply(n,arguments):n.queue.push(arguments)};
  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
  n.queue=[];t=b.createElement(e);t.async=!0;
  t.src=v;s=b.getElementsByTagName(e)[0];
  s.parentNode.insertBefore(t,s)}(window, document,'script',
  'https://connect.facebook.net/en_US/fbevents.js');
  fbq('init', '1218217704994477');
  fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
  src="https://www.facebook.com/tr?id=1218217704994477&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->

  {% include 'SPO-social-meta-tags' %}
  <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  {% if settings.favicon != blank %}
    <link rel="shortcut icon" href="{{ settings.favicon | img_url: '32x32' }}" type="image/png">
  {% endif %}


  {% include 'head_fonts' %}
  {{ '//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css' | stylesheet_tag }}
  {{ 'theme.scss.css' | asset_url | stylesheet_tag }}

  <script>
    var theme = {
      strings:{
        sold_out: {{ 'products.product.sold_out' | t | json }},
        add_to_cart: {{ 'products.product.add_to_cart' | t | json }},
        unavailable: {{ 'products.product.unavailable' | t | json }},
        increase_quantity: {{ 'cart.general.increase_quantity' | t | json }},
        reduce_quantity: {{ 'cart.general.reduce_quantity' | t | json }}
      },
      settings: {
        ajax_cart_enable: {% if settings.ajax_cart_enable %}{{ settings.ajax_cart_enable | json }}{% else %}null{% endif %},
        moneyFormat: {{ shop.money_format | json }}
      }
    };
  </script>

  {{ '//ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js' | script_tag }}
  <!--[if (gt IE 9)|!(IE)]><!--><script src="{{ 'vendor.js' | asset_url }}" defer="defer"></script><!--<![endif]-->
  <!--[if lte IE 9]><script src="{{ 'vendor.js' | asset_url }}"></script><![endif]-->

  <!--[if (gt IE 9)|!(IE)]><!--><script src="{{ 'theme.js' | asset_url }}" defer="defer"></script><!--<![endif]-->
  <!--[if lte IE 9]><script src="{{ 'theme.js' | asset_url }}"></script><![endif]-->

  {% include 'buddha-megamenu-before' %}
  {% include 'buddha-megamenu' %}
  {{ content_for_header }}

  {% if template.directory == 'customers' %}
    {{ 'shopify_common.js' | shopify_asset_url | script_tag }}
  {% endif %}

<!-- BeginConsistentCartAddon -->  <script>  {% if customer %}  Shopify.merge_cart_text = '{{ "consistent_cart_addon.merge_cart_text" | t }}' ;  Shopify.customer_logged_in = true ;  Shopify.customer_email = "{{ customer.email }}" ;  Shopify.log_uuids = true;  {% else %}  Shopify.customer_logged_in = false ;  Shopify.customer_email = "" ;  Shopify.log_uuids = true;  {% endif %}  </script>  <!-- EndConsistentCartAddon -->

                      <!--StartCartCartCustomCode-->
                      
                      <!-- Abandoned Cart Information -->
                      <div id="care-cart-customer-information" style="display:none">
                        {"id":"{{customer.id}}", "email":"{{ customer.email }}","default_address":{{ customer.default_address | json }},"first_name":"{{ customer.first_name }}","last_name":"{{ customer.last_name }}","name":"{{ customer.name }}" }
                      </div>
                      <!-- Abandoned Cart Information -->
                      
                      <!--  ShopInformation -->
                      <div id="care-cart-shop-information" style="display:none">
                        {"domain":"{{shop.permanent_domain}}" }
                      </div>
                      <!--  ShopInformation -->
                      
                      <!--EndCareCartCustomCode-->
                        {% include 'judgeme_core' %}
</head>

<body id="{{ page_title | handle }}" class="{% if customer %}customer-logged-in {% endif %}template-{{ template | replace: '.', ' ' | truncatewords: 1, '' | handle }}" >
  {% include 'buddha-megamenu-wireframe' %}

  <div id="PageContainer"{% if color %} class="{{ color }}"{% endif %}>

    {% section 'header' %}

    <main class="main-content" role="main">

      {{ content_for_layout }}

    </main>

    {% section 'footer' %}

  </div>

  <script type="text/javascript">
    if ( window.devicePixelRatio > 1 ) {
      var retinaImages = document.getElementsByClassName('retina-img');
      for (var i = 0; i <= retinaImages.length; i++ ) {
        if ( retinaImages[i] != undefined ) {
          retinaImages[i].setAttribute('src', retinaImages[i].getAttribute('data-retina-src'));
        }
      }
    }
  </script>

  <script type="text/javascript">

    {% capture jQuery_plus_icon %} {% include "asset_svg" with "plus" %} {% endcapture %}
    {% capture jQuery_minus_icon %} {% include "asset_svg" with "minus" %} {% endcapture %}
    {% capture jQuery_close_icon %} {% include "asset_svg" with "close" %} {% endcapture %}
    {% capture jQuery_arrow_down_icon %} {% include "asset_svg" with "arrow_down" %} {% endcapture %}
    {% capture jQuery_arrow_left_icon %} {% include "asset_svg" with "arrow_left" %} {% endcapture %}
    {% capture jQuery_arrow_right_icon %} {% include "asset_svg" with "arrow_right" %} {% endcapture %}

    jQuery.themeAssets = {
      plus: '{{ jQuery_plus_icon | lstrip | rstrip }}',
      minus: '{{ jQuery_minus_icon | lstrip | rstrip }}',
      close: '{{ jQuery_close_icon | lstrip | rstrip }}',
      arrow_down: '{{ jQuery_arrow_down_icon | lstrip | rstrip }}',
      arrow_left: '{{ jQuery_arrow_left_icon | lstrip | rstrip }}',
      arrow_right: '{{ jQuery_arrow_right_icon | lstrip | rstrip }}'
    }

  </script>


  <script>
    {% if newHash %}
      $(function() {
        timber.updateHash('{{ newHash }}');
      });
    {% endif %}
    {% if resetPassword %}
      $(function() {
        timber.resetPasswordSuccess();
      });
    {% endif %}
  </script>


<script src="//cdn.codeblackbelt.com/js/modules/currency-converter-plus/main.min.js?shop=everything-summer.myshopify.com"></script>
{% include "hurrify-snippet" %}<!-- BEEKETINGSCRIPT CODE START -->{% include 'bk-tracking' %}<!-- BEEKETINGSCRIPT CODE END -->{% include 'banana-stand-footer' %}
</body>
</html>

0 Likes
Highlighted
Community Moderator
Community Moderator
3156 237 523

Hi Wei Yew, 

Nick here from Shopify. 

You can now add the Facebook Pixel code to your store without having to edit the code in any way. You can add it by going to:

  • Online Store > Preferences.

  • In the Facebook Pixel section, add your Facebook pixel ID:

    • If you're adding a pixel for the first time, then enter the Facebook pixel ID as seen below. 
    • If you're changing to a new Facebook pixel from an existing one, then click Change before entering the new Facebook pixel ID and then click Save.
  • Once you have added the new pixel here you would need to remove the existing pixel from the code which you linked in your post above. 

Shopify has a guide going through all the steps for adding the new pixel code and removing the old one from the code which you can find here

Hopefully, that helps. Don't hesitate to ask any other questions about this should you have any. 

All the best, Nick

Nick | Community Moderator @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes