Announcement

Collapse
No announcement yet.

Array of product codes on BASK, INVC, etc...

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

    Array of product codes on BASK, INVC, etc...

    Looking to make my Facebook Pixel reporting a little more robust. I'd like to populate the content_ids field with all of the codes on the order. Any idea? I do have toolkit.

    <script>
    fbq('track', 'Purchase', {
    content_ids: ['1234', '4642', '35838'],
    content_type: 'product',
    value: &mvt:order:total;,
    currency: 'USD'
    });
    </script>
    www.jcroffroad.com

    #2
    To answer my own question.

    Code:
                   <mvt:assign name="g.prodarray" value="'['" />
               <mvt:foreach iterator="item" array="order:items">
               <mvt:assign name="g.prodarray" value="g.prodarray $ '\"' $ l.settings:item:code $ '\"' $ ','" />
               </mvt:foreach>
               <mvt:assign name="g.prodarray" value="substring(g.prodarray,1,len(g.prodarray)-1)" />
               <mvt:assign name="g.prodarray" value="g.prodarray $ ']'" />
    
                   fbq('track', 'Purchase', {
                   content_name: 'Purchase',
                   content_ids: '&mvt:global:prodarray;',
                   content_type: 'product',
                   value: &mvt:order:total;,
                   currency: 'USD'
                   });
    Last edited by monkeyevil; 01-19-18, 07:42 AM.
    www.jcroffroad.com

    Comment


      #3
      hey monkeyevil can I use this on my site? THANKS

      Comment


        #4
        Is this code working for you? For some reason it doesn't seem to be working for me.

        Comment

        Working...
        X