Announcement

Collapse
No announcement yet.

Facebook Pixel Code

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

  • #31
    Indeed, but I am trying to get a solution to using the pixel code in v14 sites.

    v14 does not have the <actinic:variable name="OrderTotalBaseUnit" /> variable.

    Can this be created somehow?????
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    Comment


    • #32
      It's not a copy/paste solution. Use the first line from my fix but remove the BlockIf as you should be putting the code on the Receipt layout somewhere near the bottom.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


      • #33
        And make sure that id="idGrandTotal" is added the the <b> tag that surrounds the Total on the Total Row layout and use idGrandTotal instead of idCartHeadingTotal.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


        • #34
          Or an alternative fix for your post #29 is to sanitize those &#nnn; bits by simply replacing:
          Code:
          fbq('track', 'Purchase', {value: ('<Actinic:Variable Name="Total"/>').replace(/[^0-9\.]/g, ''), currency: 'GBP'});
          with
          Code:
          fbq('track', 'Purchase', {value: $( "<div/>" ).html('<actinic:variable name="Total" />').text().replace(/[^\d\.]/g, ''), currency: 'GBP'});
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


          • #35
            Perfect!

            This is the result:
            Code:
            CUSTOM PARAMETERS SENT
            value: 78.24
            currency: GBP
            This is the Pixel code on the receipt page near the bottom:

            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', 'xxxxxxxxxxxxxxx');
            fbq('track', 'PageView');
            fbq('track', 'Purchase', {value: $( "#idGrandTotal" ).text().replace(/[^0-9\.]/g, ''), currency: 'GBP'});
            </script>
            <noscript>
            <img height="1" width="1" src="https://www.facebook.com/tr?id=xxxxxxxxxxxxxxx&ev=PageView&noscript=1"/>
            </noscript>
            This is the edited Layout Code - Total Row:

            Code:
            <Actinic:REMOVE TAG="TotalRow">
            <tr class="checkoutMobileTR">
               <td align="right" colspan="<Actinic:Variable Name="PriceColSpan"/>"><b><Actinic:Variable Name="TotalCaption"/></b></td>
               <td align="right" class="checkout-cartheading"><b id="idGrandTotal"><Actinic:Variable Name="Total"/></b></td>
            </tr>
            </Actinic:REMOVE>
            Thank you so much Norman.
            Jonathan Chappell
            Website Designer
            SellerDeck Website Designer
            Actinic to SellerDeck upgrades
            Graphicz Limited - www.graphicz.co.uk

            Comment


            • #36
              I've implemented this - thanks to all who contributed - and it works a treat.

              I've put a blockif round the code, though, to stop it firing when I do a page preview from within SD.

              i.e a BLOCKIF with a condition of IsNotPreviewMode
              Elysium:Online - Official Accredited SellerDeck Partner
              SellerDeck Design, Build, Hosting & Promotion
              Based in rural Northants

              Comment


              • #37
                Originally posted by Goz View Post
                I've implemented this - thanks to all who contributed - and it works a treat.

                I've put a blockif round the code, though, to stop it firing when I do a page preview from within SD.

                i.e a BLOCKIF with a condition of IsNotPreviewMode

                Probably the most useful block if statement... wrap it around everything!

                Bing tracking is another element that benefits these block ifs - it constantly attempts to fire.
                Matt. M - SMR Enterprises Ltd.

                Comment


                • #38
                  In similar vein, Google has given a client this new Analytics Ecommerce Tracking Code (for the receipt page) which needs the correct variables entered to collect the data ( - This is a v18.0.1 site)

                  The basic version of the sample code provided by Google:

                  Code:
                  <script>
                  gtag('event', 'purchase', {
                    "transaction_id": "24.031608523954162",
                    "affiliation": "Google online store",
                    "value": 23.07,
                    "currency": "USD",
                    "tax": 1.24,
                    "shipping": 0,
                    "items": []
                  });
                  </script>
                  I wondered if the code should be something like:


                  Code:
                  <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22" >
                  <script>
                  gtag('event', 'purchase', {
                    "transaction_id": '<actinic:variable name="TheOrderNumber" />',
                    "affiliation": "Google online store",
                  value: '<actinic:variablename="OrderTotalBaseUnit" />',
                  currency: "GBP",
                   "tax": 0,
                    "shipping": 0,
                    "items": []
                  });
                  </script>
                  </actinic:block>
                  Or whether I should try this from the latest v18.0l.1 pixel code:

                  Code:
                  value: '<actinic:variable name="NumericOrderTotal" />',
                  currency: '<actinic:variable name="DefaultIntCurrencySymbol" />'
                  Advice very gratefully received.

                  Thank you
                  Jonathan Chappell
                  Website Designer
                  SellerDeck Website Designer
                  Actinic to SellerDeck upgrades
                  Graphicz Limited - www.graphicz.co.uk

                  Comment

                  Working...
                  X