PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Signup tracking; product info never shows in Google Analytic

s2Member Plugin. A Membership plugin for WordPress®.

Signup tracking; product info never shows in Google Analytic

Postby sugeneris » May 20th, 2011, 6:34 am

In the membership tracking code area, I've included the snippet below. This is lifted directly from the Google Analytics documentation.

Over in Analytics, under the Ecommerce section, the Transactions view seems to be working fine, which as far as I can tell comes from the _addTrans portion of the code. The "quantity" column always shows 0, but we'll come to that in the next bit as that's not an _addTrans value.

The Product Performance area, though, shows absolutely no data. This is the stuff that should be coming from the _addItem chunk. Note that the quantity is hard-coded as "1" and that we already know the %%subscr_id%% variable works from the Transaction info. So, even if not all the information is getting through, at the very least the transactions should be showing a quantify of 1.

Based on that, I have to assume that the entire _addItem block is failing, but I can't see why. Has anyone else gotten this to work, and could you share your code? I'm using s2Member Pro 3.5.8 on WP 3.1.2


Code: Select all
<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
    _gaq.push(['_setDomainName', '.example.com']);
    _gaq.push(['_trackPageview']);

    _gaq.push(['_addTrans',
       '%%subscr_id%%',           // order ID - required
       'Client Site Name', // affiliation or store name
       '%%initial%%',          // total - required
       '',           // tax
       '',              // shipping
       '',       // city
       '',     // state or province
       ''             // country
    ]);
   // add item might be called for every item in the shopping cart
  _gaq.push(['_addItem',
    '%%subscr_id%%',           // order ID - required
    '%%item_number%%',           // SKU/code - required
    '%%item_name%%',        // product name
    '',   // category or variation
    '%%initial%%',          // unit price - required
    '1'               // quantity - required
  ]);

  _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers


    (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>
User avatar
sugeneris
Registered User
Registered User
 
Posts: 20
Joined: October 15, 2010

Re: Signup tracking; product info never shows in Google Anal

Postby Jason Caldwell » May 23rd, 2011, 6:24 pm

Investigating now. Thanks for your patience.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Signup tracking; product info never shows in Google Anal

Postby Jason Caldwell » May 23rd, 2011, 6:36 pm

What is the exact value of this Replacement Code?
%%item_name%%

Does it contain any single-quotes? If so, that could cause it to fail in this context, because the value is wrapped with single-quotes as well. In other words, this would cause it to fail.

Code: Select all
  _gaq.push(['_addItem',
    '%%subscr_id%%',           // order ID - required
    '%%item_number%%',           // SKU/code - required
    'Jason's Item',        // product name ( FAIL )
    '',   // category or variation
    '%%initial%%',          // unit price - required
    '1'               // quantity - required
  ]);
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Signup tracking; product info never shows in Google Anal

Postby sugeneris » May 24th, 2011, 12:53 pm

Oddly, it started working about two days later. Maybe commerce tracking takes a bit longer to get results showing, or something.

The quote bit is a good point, though. Might be a good idea to throw in a quick warning about that.
User avatar
sugeneris
Registered User
Registered User
 
Posts: 20
Joined: October 15, 2010

Re: Signup tracking; product info never shows in Google Anal

Postby Jason Caldwell » May 24th, 2011, 7:30 pm

Thanks for reporting back on this.
It's much appreciated.

Certainly, I'll see what we can do about that in a future release.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA


Return to s2Member Plugin

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests

cron