Trying to get ecommerce Tracking working in ASP / javascript code

Hi ,

I am trying to get Piwik tracking to work on my site.
I am coding in ASP and here is a copy of my code where I am trying to implement this. I am not seeing errors, however when I log into my piwik analytics site to see the ecommerce tracking info – I don’t see anything.

Any help would be appreciated.

Thank you,

//on the order complete page, I set this pcPWorderComplete variable to 1

<%

IF pcPWorderComplete=1 THEN '1

    'on error resume next
    
    dim pPWGetItems, pcPWtransaction, pcPWtransactionItems

    pGetItems = 1
    
    call openDb()
    
    '// Piwik Analytics
    '// STEP 1: GENERATE ORDER INFO LINE
    '// STEP 2: GENERATE ITEM INFO LINES
    
    '// STEP 1 - START
    
        '// Get order info from db
    
        query="SELECT shipmentDetails, taxAmount, total, taxDetails, ord_VAT FROM orders WHERE idOrder=" & pOID
        set rs=Server.CreateObject("ADODB.Recordset" )
        set rs=conntemp.execute(query)
        
        if err.number <> 0 then
            set rs=nothing
            pGetItems = 0
            call closeDb()
        end If
        
        if rs.eof then
            set rs=nothing
            pGetItems = 0
            call closeDb()
        end if
                    
        IF pGetItems<>0 THEN ' 2 - If database errors, skip everything
                     
            pIdOrder = pOID
        
            '// Order Total
            ptotal=rs("total" )
                
            '// Gather tax information to determine total tax amount
            ptaxAmount=rs("taxAmount" )
            ptaxDetails=rs("taxDetails" )
            pord_VAT=rs("ord_VAT" )
            if pord_VAT>0 then
                ptaxAmount=pord_VAT
            else
                if isNull(ptaxDetails) OR trim(ptaxDetails)="" then
                    ptaxAmount=ptaxAmount
                else
                    taxArray=split(ptaxDetails,"," )
                    ptaxTotal=0
                    for i=0 to (ubound(taxArray)-1)
                        taxDesc=split(taxArray(i),"|" )
                        ptaxTotal=ptaxTotal+taxDesc(1)
                    next 
                    ptaxAmount=ptaxTotal
                end if
            end if
            
            '// Gather shipping information to determine total shipping amount
            pshipmentDetails=rs("shipmentDetails" )
                pTotalShipping=0
                shipping=split(pshipmentDetails,"," )
                if ubound(shipping)>1 then
                    if NOT isNumeric(trim(shipping(2))) then
                        pTotalShipping=0
                    else
                        Postage=trim(shipping(2))
                        if ubound(shipping)=>3 then
                            serviceHandlingFee=trim(shipping(3))
                            if NOT isNumeric(serviceHandlingFee) then
                                serviceHandlingFee=0
                            end if
                        else
                            serviceHandlingFee=0
                        end if
                        if serviceHandlingFee<>0 then
                            pTotalShipping=CDbl(Postage)+CDbl(serviceHandlingFee)
                        else
                            pTotalShipping=CDbl(Postage)
                        end if
                    end if
                end if
                
           
            set rs = nothing
       
            pcPWtransaction = "_paq.push(['trackEcommerceOrder', '" & CStr(pIdOrder) & "'," &  ptotal & "," & ptotal & "," &  ptaxAmount & "," &  pTotalShipping & "]);
    
        END IF ' 2 - End If database errors, skip everything
        call closeDb()            
    '// STEP 1 - END
    
    '// STEP 2 - START
                                    
        '// Gather item info from database
        call openDb()        
        query="SELECT ProductsOrdered.idProduct, ProductsOrdered.quantity, ProductsOrdered.unitPrice, products.description, products.sku FROM ProductsOrdered, products WHERE ProductsOrdered.idProduct=products.idProduct AND ProductsOrdered.idOrder=" & pOID
        set rs=Server.CreateObject("ADODB.Recordset" )
        set rs=conntemp.execute(query)
        
        if err.number <> 0 then
            set rs=nothing
            pGetItems = 0
            call closeDb()
        end If
        
        if rs.eof then
            set rs=nothing
            pGetItems = 0
            call closeDb()
        end if
                
        IF pGetItems<>0 THEN ' 3 - If database errors, skip everything
                
            pcPWtransactionItems = ""

            Do While Not rs.eof
                
                pIdProduct = rs("idProduct" )            
                pSKU = rs("sku" )
                    pSKU = replace(pSKU,"|","-" )
                pName = rs("description" )
                    pName = replace(pName,"|","-" )
                pUnitPrice = rs("unitPrice" )
                pQuantity = rs("quantity" )
                
                    '// Find category information
                    query="SELECT idCategory FROM categories_products WHERE idProduct ="& pIdProduct
                    set rsTemp=server.CreateObject("ADODB.RecordSet" )
                    set rsTemp=conntemp.execute(query)
                    if not rsTemp.eof then
                        idCategory=rsTemp("idCategory" )
                        query="SELECT categoryDesc FROM categories WHERE idCategory =" & idCategory
                        set rsTemp=conntemp.execute(query)
                        if err.number <> 0 then
                            set rsTemp=nothing
                            pCategory = "NA"
                        end If
                        if rsTemp.eof then
                            response.write "yes"
                            response.End()
                            set rsTemp=nothing
                            pCategory = "NA"
                        end if
                        pCategory = rsTemp("categoryDesc" )
                    else
                        pCategory = "NA"
                    end if
                    pCategory = replace(pCategory,"|","-" )
                    set rsTemp=nothing
            
                '// Item line example per Piwik Analytics documentation
                pcPWtransactionItems = pcPWtransactionItems & "_paq.push(['addEcommerceItem', '" & pSKU & "', '" & pName & "', '" & pCategory & "', " & pUnitPrice & "," & pQuantity & "]); "  
       

            rs.movenext
            loop
            set rs = nothing
            
        END IF ' 3 - End If database errors, skip everything
    
    '// STEP 2 - END
    
    call closeDb()
    

    %>
    <script type="text/javascript">
        <%=pcPWtransactionItems%>
        <%=pcPWtransaction%>
        _paq.push(['trackPageView']);
    
    </script> 

<%
END IF
%>

( when I view the source on the page - i see _paq.push([‘trackEcommerceOrder’, ‘325452’, 78.99, 78.99, 0, 8.99 ]);
_paq.push([‘addEcommerceItem’, 845258412536’, ‘this is product name’, ‘n/a’, 12.50, 1]);
_paq.push([‘trackPageView’]); )

Don’t you have to do ‘addecommerceitem’ before ‘trackecommerceitem’ ?