Announcement

Collapse
No announcement yet.

Facebook Pixel Code layout not collecting totals.

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

    Facebook Pixel Code layout not collecting totals.

    Problem 1:

    The Facebook Pixel Code layout is placed above </head> in overall layouts.

    This is a bad place for it as it contains an IMG tag.

    I suggest moving it to above </body> in all these layouts. This will also help fix:

    Problem 2:

    The lines:
    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22">fbq('track', 'InitiateCheckout', {value: '<actinic:variable name="Total" />', currency: 'GBP'});</actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22">fbq('track', 'Purchase', {value: '<actinic:variable name="Total" />', currency: 'GBP'});</actinic:block>
    Both fail because the Total variable is only valid within the Shopping Cart Grid layout.

    This code will fix that:
    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22">fbq('track', 'InitiateCheckout', {value: $( "#idCartHeadingTotal" ).text().replace(/[^0-9\.]/g, ''), currency: 'GBP'});</actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22">fbq('track', 'Purchase', {value: '<actinic:variable name="OrderTotalBaseUnit" />', currency: 'GBP'});</actinic:block>
    But only if the Facebook Pixel Code layout is placed above </body> as per my (1).
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    #2
    Thanks Norman, that's very helpful. I think that was my own oversight, not yet detected. We will replace the Total variable as indicated.

    I understand your point about the position, but Facebook does advise placing the code just above the closing head tag. I'm not sure what the user response will be if we go against their directions. Most won't be aware, I know, but some may query it.
    https://www.facebook.com/business/help/952192354843755

    Whether or not it's strictly a valid position seems debatable, but browsers don't seem to have an issue with it.

    I will find out if there's a modification to your code that will work in the head section.
    Bruce Townsend
    Ecommerce Product Manager
    Sellerdeck Ecommerce Solutions

    Comment


      #3
      Can you use NumericOrderTotalCgi instead of total variable and see if that works

      Comment


        #4
        Originally posted by NormanRouxel View Post
        Problem 1:

        The Facebook Pixel Code layout is placed above </head> in overall layouts.

        This is a bad place for it as it contains an IMG tag.

        I suggest moving it to above </body> in all these layouts. This will also help fix:

        Problem 2:

        The lines:
        Code:
        <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22">fbq('track', 'InitiateCheckout', {value: '<actinic:variable name="Total" />', currency: 'GBP'});</actinic:block>
        <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22">fbq('track', 'Purchase', {value: '<actinic:variable name="Total" />', currency: 'GBP'});</actinic:block>
        Both fail because the Total variable is only valid within the Shopping Cart Grid layout.

        This code will fix that:
        Code:
        <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22">fbq('track', 'InitiateCheckout', {value: $( "#idCartHeadingTotal" ).text().replace(/[^0-9\.]/g, ''), currency: 'GBP'});</actinic:block>
        <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22">fbq('track', 'Purchase', {value: '<actinic:variable name="OrderTotalBaseUnit" />', currency: 'GBP'});</actinic:block>
        But only if the Facebook Pixel Code layout is placed above </body> as per my (1).
        Can you use

        <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22" >fbq('track', 'InitiateCheckout', {value: ' if (getCartItem(3) == 0)

        Unknown macro: { document.write(FormatPrices(0)); }
        if (getCartItem(3) == 1)

        Unknown macro: { document.write(getCartItem(1)); }

        if (getCartItem(3) > 1)

        ', currency: 'GBP'});</actinic:block>
        <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22">fbq('track', 'Purchase',

        Unknown macro: {value}
        );</actinic:block>

        Comment


          #5
          A quick google found:
          you can place it inside the <BODY> element but FB recommends to keep it at the beginning of <BODY> or in the <HEAD> as the conversion will be then counted even if the page does not load fully or the user closes the page
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            A P.S. The Facebook Pixel Code layout has hard-coded GBP for the currency.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Thanks Norman. We have fixes ready for both of these issues
              Bruce Townsend
              Ecommerce Product Manager
              Sellerdeck Ecommerce Solutions

              Comment

              Working...
              X