Can't track conversions

Discussion in 'Troubleshooting' started by graham12, Dec 14, 2011.

  1. graham12

    graham12 New Member

    Joined:
    Sep 25, 2007
    Messages:
    2
    I've followed tutorials by David, forum posts, but I can't get any conversion data. I've installed Google Analytics and Kissmetrics but I'm having no luck. I can verify that the code is installed correctly on my thanks.php page but no conversions get tracked.

    Any ideas?
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    What you have in thanks.php? What payment systems do you use?
  3. graham12

    graham12 New Member

    Joined:
    Sep 25, 2007
    Messages:
    2
    I use 1shoppingcart and paypal. Not sure what you mean about what I have in thanks.php. The code? I didn't edit my thanks.php but I have this in the head of my layout.html:
    <script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-25954165-1']);
    _gaq.push(['_trackPageview']);

    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

    </script>
    <script type="text/javascript">
    var _kmq = _kmq || [];
    function _kms(u){
    setTimeout(function(){
    var s = document.createElement('script'); var f = document.getElementsByTagName('script')[0]; s.type = 'text/javascript'; s.async = true;
    s.src = u; f.parentNode.insertBefore(s, f);
    }, 1);
    }
    _kms('//i.kissmetrics.com/i.js');_kms('//doug1izaerwt3.cloudfront.net/bda8cd218b62e3cff1b6ba2d468fc4337e517899.1.js');
    </script>
    </head>

    But I added this to my thanks.html

    {if $total > "0.0"}
    {literal}
    <script type="text/javascript">
    {/literal}
    _gaq.push(['_setAccount', 'UA-25954165-1']);
    _gaq.push(['_addTrans',
    '{$payment.payment_id}', // order ID - required
    '', // affiliation or store name
    '{$total|string_format:'%.2f'}', // total - required
    '0', // tax
    '0', // shipping
    '{$member.city}', // City
    '{$member.state}', // State
    '{$member.country}', // Country
    ]);

    {foreach from=$products item=p}
    _gaq.push(['_addItem',
    '{$payment.payment_id}', // order ID - required
    '{$p.product_id}', // SKU/code
    '{$p.title}', // product name
    '', // category or variation
    '{$p.price}', // unit price - required
    '1' // quantity - required
    ]);
    {/foreach}
    _gaq.push(['_trackTrans']);
    </script>
    <script type="text/javascript">
    _kmq.push(['record', 'Signed Up', {'Plan':'6-Month Membership', 'Amount':27.00}]);
    </script>
    {/if}
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Ok. now try to purchase as regular user and when you will be redirected back to /amember/thanks.php open page source code and check:
    1. Was code added to thanks page?
    2. Was code correct and have all necessary variables included?

Share This Page