Piwik analytics with amember

Discussion in 'aMember Pro v.4' started by mutualadvantage, Mar 14, 2012.

  1. mutualadvantage

    mutualadvantage New Member

    Joined:
    May 3, 2006
    Messages:
    7
    While Google analytics is good I do like to cross check and have a bit of independence from big brother which is why I decided to use Piwik for my analytics and ecommerce tracking. I'm now trying to get the ecommerce element working with amember and need a bit of help please.

    I've read through the available help and forum posts in both forums and have got as far as I can as I'm not a coder.

    If I understand correctly I need to add some java script to my amember thanks.phtml file.

    To track ecommerce orders Piwik uses two functions found here

    In the amember forums I found this thread helping with tracking conversions which gave me an idea of what I might use to populate the functions with the correct data, some of it is PHP and some smarty(?). Below I've added those snippets I've identified.

    Code:
    productSKU,- '{$p.product_id}'
    
    productName,- <?php p($p->item_title)?> or {$p.title}
    
    productCategory,-
    
    price,- <?php echo ($invoice->first_subtotal) ?>
    
    quantity -
    
    orderId, - '{$payment.payment_id}'
    
    grandTotal,- <?php echo ($invoice->first_total) ?>
    
    subTotal,- <?php echo ($invoice->first_subtotal) ?>
    
    tax,- <?php echo ($invoice->first_tax) ?>
    
    shipping,
    
    discount,
    Is this the best way to collect the data needed?
    Would the following javascript work/is this what i need to add to thanks.phtml?

    Code:
    <script type="text/javascript">
    
    piwikTracker.addEcommerceItem('{$p.product_id}', '{$p.title}', productCategory, <?php echo ($invoice->first_subtotal) ?>, quantity);
    piwikTracker.trackEcommerceOrder('{$payment.payment_id}', <?php echo ($invoice->first_total) ?>, <?php echo ($invoice->first_subtotal) ?>, <?php echo ($invoice->first_tax) ?>, shipping, discount);
    
    </script>
    thanks in advance for any help or the solution.





  2. alex

    alex Administrator Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,020
    Look at files
    amember/application/plugins/misc/getclicky.php
    and
    amember/application/plugins/misc/google-analytics.php
    for examples, or let me know if you have no programming skills.
  3. mutualadvantage

    mutualadvantage New Member

    Joined:
    May 3, 2006
    Messages:
    7
    Thanks for the point in the right direction. I'll see how I get on.

    For anyone else following along the correct path appears to be /amember/application/default/plugins/misc
    relapse likes this.
  4. chrome62

    chrome62 Member

    Joined:
    Apr 22, 2008
    Messages:
    89
    Any luck ever getting piwik to work with amember?

Share This Page