Announcement

Collapse
No announcement yet.

Facebook Pixel

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Facebook Pixel

    Hello everyone!

    I need help regarding with how to install a Facebook pixel for my client website.

    I tried to look for ways in Google and I cannot find any tutorial on this.

    Also, when the Facebook pixel is installed does it automatically track purchases?

    Need your help guys!

    Thanks

  • Could also use some help in this arena - did you find anyone?

    Comment


    • This might get you a start:

      Code:
      <!-- 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", "PIXEL_ID_THING");
      fbq("track", "PageView");
      <mvt:if expr="'PROD' CIN g.Screen">
          fbq("track", "ViewContent", {
              content_type: 'product_group',
              content_ids: ["&mvte:product:code;"],
              content_name: "&mvte:product:name;",
              <mvt:if expr="NOT ISNULL g.Category_Code">
                  content_category: "&mvte:global:Category_Code;",
              </mvt:if>
              value: &mvte:product:price;,
              currency: 'USD'
          });
      </mvt:if>
      <mvt:if expr="g.Screen EQ 'BASK'">
      
          <mvt:comment>Concatenate product codes</mvt:comment>
          <mvt:foreach iterator="group" array="basket:groups">
              <mvt:if expr="pos1 EQ 1">
                  <mvt:assign name="g.group_codes" value="l.settings:group:code" />
              <mvt:else>
                  <mvt:assign name="g.group_codes" value="g.group_codes $ ', ' $ l.settings:group:code" />
              </mvt:if>
          </mvt:foreach>
      
          fbq("track", "AddToCart" {
              content_type: 'product_group',
              content_ids: ["&mvte:global:group_codes;"]
          }
      
          });
      </mvt:if>
      <mvt:if expr="g.Screen EQ 'OCST'">
          fbq("track", "InitiateCheckout");
      </mvt:if>
      <mvt:if expr="g.Screen EQ 'INVC'">
      
          <mvt:comment>Concatenate product codes</mvt:comment>
          <mvt:foreach iterator="item" array="order:items">
              <mvt:if expr="pos1 EQ 1">
                  <mvt:assign name="g.group_codes" value="l.settings:group:code" />
              <mvt:else>
                  <mvt:assign name="g.group_codes" value="g.group_codes $ ', ' $ l.settings:group:code" />
              </mvt:if>
          </mvt:foreach>
      
          fbq("track", "Purchase", {
              value: "&mvte:order:total;",
              currency: "USD",
              content_type: 'product_group',
              content_ids: ["&mvte:global:group_codes;"]
          });
      </mvt:if>
      </script>
      <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=PIXEL_ID_THING&ev=PageView&noscript=1"></noscript>
      <!-- End Facebook Pixel Code -->

      Comment


      • Hi - We tried implementing your code in Google Tag Manager and we get this error " Error at line 11, character 2: Parse error. primary expression expected". Any way to fix this error? Thxs

        Comment


        • UnfortunateIy, I don't think this code can be used directly in Tag Manager because it isn't 100% javascript. It iincludes SMT code that requires the Miva engine to parse it.

          Comment

          Working...
          X

          This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

          This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

          Accept