More order tracking pixel fun

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lesliekirk
    Super Moderator











    • Aug 2008
    • 9306

    #1

    More order tracking pixel fun

    While I've pretty much got the javascript side of the event data tracking figured out (for the order data), now I've come upon a new (to me) twist in the noscript img event data. In the javascript version it was "easy" to figure out where the <mvt:foreach iterator="item" array="order:items"> went to create something like this

    Code:
     line_items: [
    
    {
    product_name: 'Pillows (Set of 2)'  ,
    product_id: '11'  ,
    product_price: 48.00  ,
    product_quantity: 1
     },
    
    {
    product_name: 'Pillows, Large (Set of 2)'  ,
    product_id: '15'  ,
    product_price: 68.00  ,
    product_quantity: 1
     }
    ]
    I am clueless how to place it here:

    Code:
     USD&ed[line_items][0][product_name]=Parker+Boots&ed[line_items][0][product_id]='1414'&ed[line_items][0][product_price]=5.00&ed[line_items][0][product_quantity]=1&ed[line_items][1][product_name]=Parker+Sandals&ed[line_items][1][product_id]='ABC'&ed[line_items][1][product_price]=5.00&ed[line_items][1][product_quantity]=1
    (easier to read with a little whitespace that has to be removed):

    Code:
    &ed[line_items][0][product_name]=Parker+Boots
    &ed[line_items][0][product_id]='1414'
    &ed[line_items][0][product_price]=5.00
    &ed[line_items][0][product_quantity]=1
    &ed[line_items][1][product_name]=Parker+Sandals
    &ed[line_items][1][product_id]='ABC'
    &ed[line_items][1][product_price]=5.00
    &ed[line_items][1][product_quantity]=1
    I figure at the very least some sort of counter is needed.

    Okay, one question that does relate to both tags - is there a Miva token for the total quantity of items ordered? In the case of this example it would be 2 (one of each).
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: X | Facebook | Pinterest
  • lesliekirk
    Super Moderator











    • Aug 2008
    • 9306

    #2
    Let me rephrase my confusion a little better - I think I just need a counter to advance the line item number. I've got the code for the pixel, I just don't know how to get line_items number to change to 1 for the next item.

    this appears to work for the rest

    Code:
    <mvt:foreach iterator="item" array="order:items">&ed[line_items][0][product_name]=&mvte:item:name;&ed[line_items][0][product_id]='&mvte:item:code;'&ed[line_items][0][product_price]=&mvte:item:price;&ed[line_items][0][product_quantity]=&mvt:item:quantity;"/></mvt:foreach>
    well except that I need the 0 to change to 1 for the next item (and so on).
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: X | Facebook | Pinterest

    Comment

    • Kent Multer
      Mega Mivite









      • Mar 2006
      • 3255

      #3
      If I understand you correctly, you could use an mvt:assign tag that adds 1 to a local variable each time you go through the loop.

      To get the number of elements in an array, you can use the Miva Script function miva_array_elements(l.YourArray) .

      HTH --
      Kent Multer
      Magic Metal Productions
      http://TheMagicM.com
      * Web developer/designer
      * E-commerce and Miva
      * Author, The Official Miva Web Scripting Book -- available on-line:
      http://www.amazon.com/exec/obidos/IS...icmetalproducA

      Comment

      • lesliekirk
        Super Moderator











        • Aug 2008
        • 9306

        #4
        Originally posted by Kent Multer View Post
        If I understand you correctly, you could use an mvt:assign tag that adds 1 to a local variable each time you go through the loop.

        To get the number of elements in an array, you can use the Miva Script function miva_array_elements(l.YourArray) .

        HTH --
        Well I understood mvt:assign, loop and array but not how to put it all together...
        Leslie Kirk
        Miva Certified Developer
        Miva Merchant Specialist since 1997
        Previously of Webs Your Way
        (aka Leslie Nord leslienord)

        Email me: [email protected]
        www.lesliekirk.com

        Follow me: X | Facebook | Pinterest

        Comment

        • Bruce - PhosphorMedia
          Developer Partner











          • Mar 2006
          • 11257

          #5
          <mvt:assign name="l.jsCnt" value="'0'"/>
          <foreach loop>
          expressed values
          <mvt:assign name="l.jsCnt" value="l.jsCnt + 1"/>
          </foreach loop>

          Or was the coffee to weak this morning?
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment

          Working...
          X