@anonymous-piwik-user opened this issue on July 12th 2011

I checked the database and have confirmed that custom vars are not being set in the log_conversion table but are being set in log_visit.

I'm using the PHP API instead of Javascript if that helps narrow things down at all.. I haven't dug into the core code much at all, so I'm not sure really how the log_conversion custom vars are being added/updated.

I have tried using both visit and page scoped vars as well...

My code goes something like this:

$piwikTracker->setCustomVariable($id = 1, $name = "Browser Version", $value = $this->agent->browser().' '.$this->agent->version(), $scope = 'visit');

Maybe there's a better way to track goal conversion rates by browser version?

Google Analytics does this, so I assumed Piwik would, but I'm not finding any way to do this and found this issue w/ custom vars. We'd like to use custom vars to segment our split-test variations as well, and if they aren't tracking conversions at all then Piwik is useless for us.

http://node.gordo4.com/snaps/5ede0a39df3b8354dc5d70af8f2d24a6.png vs http://node.gordo4.com/snaps/b2d5c80eb56ceefd9e4fc1a9a09c95de.png

This is a fresh install of 1.5.1, not an upgrade, so I'm at a loss here as to why it's not working. We get a boatload of traffic, so I'm using a cron to do the archiving. The only thing I've changed was added memory_limit 4G to the PHP commands in the cron script. Keywords: ecommerce, browser, goal, tracking, database

@anonymous-piwik-user commented on July 12th 2011

Also: http://node.gordo4.com/snaps/a327819fb2d14ffb093e169c1b4f69f4.png

I'm assuming Other, are all of the IE versions and Opera and such. Not sure why those are all meshing into Other when they have more keywords and all of the Firefox variations are shown independently, but that's beside the point of this ticket.

@mattab commented on July 14th 2011

Thanks for the report. As you can see on the demo it is working fine at least for us.

You are right that Piwik doesn't process conversion rates per browser. We process it for Countries/Custom vars/Websites/Keywords/etc. but not all user attributes (for performance reasons). Using Custom vars is therefore a good idea if you wish to achieve this.

The sub tables are limited to 50 by default (see faq). you can change this to a bigger value by overriding datatable_archiving_maximum_rows_subtable_referers in your config.ini.php (which also happens to affect custom vars subtable, not only referer - yes this is confusing ;)

log_conversion custom vars are normally copied from the log_visit table indeed. Would you be able to submit a small code using php tracking api, that would help reproduce the problem? thanks

@anonymous-piwik-user commented on July 14th 2011

On our landing page I'm calling the following to set the browser version into a custom var:

if(! $this->agent->is_robot() ){
    require_once APPPATH."libraries/PiwikTracker.php";
    PiwikTracker::$URL = 'http://xxxx.xxxx.com/analytics/';
    $piwikTracker = new PiwikTracker($idSite = 1);
    $piwikTracker->setCustomVariable($id = 1, $name = "Browser Version", $value = $this->agent->browser().' '.$this->agent->version(), $scope = 'visit');

At the top of our process_order function I'm calling:

require_once APPPATH."libraries/PiwikTracker.php";
PiwikTracker::$URL = 'http://xxxx.xxxx.com/analytics/';
$piwikTracker = new PiwikTracker($idSite = 1);

Before we attempt to process the order I run the following so we can track abandoned carts" (due to things such as CC error, etc) Basically our process_order only gets ran when the user submits our registration form. Sometimes we lose orders for various reasons, such as duplicate email, invalid CC, etc...

$piwikTracker->addEcommerceItem($sku = $order_data['product_sku'], $name = $order_data['product_name'], NULL, $price = $order_data['product_charge_now'], $quantity = 1);
$piwikTracker->doTrackEcommerceCartUpdate($grandTotal = $order_data['product_charge_now']);

Then after we actually process the card successfully we redirect to a receipt page, right before that happens I run the following:

$piwikTracker->addEcommerceItem($sku = $order_data['product_sku'], $name = $order_data['product_name'], NULL, $price = $order_data['product_charge_now'], $quantity = 1);
$piwikTracker->doTrackEcommerceOrder($orderId = $tracking_data['order_id'], $grandTotal = $order_data['product_charge_now']);

There are more examples, such as duplicate order, how we log the CC_Errors, etc... but those don't apply to this ticket and all appear to work properly.

Like I said before, the custom vars are tracking properly, but they aren't updating into the conversions table. Do I need to re-set those variables again on the conversion? I would assume the values would be copied out of the visits table upon conversion...

@anonymous-piwik-user commented on July 20th 2011

Any advice?

@mattab commented on July 22nd 2011

gordo, it would really help if you were able to produce a script that reproduces the issue on a fresh piwik install.

Are you able to test a simple version of your script that will show the issue?

we hope to fix this bug for Piwik 1.6 for sure, your help is greatly appreciated.


@anonymous-piwik-user commented on July 22nd 2011

When I get a free moment I'll setup Piwik on one of my other domains and see if I can replicate the issue and will provide access if need be.

@mattab commented on August 12th 2011

gordo, do you have an update on the issue? would be great to get this bug fixed in next release :) thanks

@mattab commented on September 28th 2011

Thanks for the report. I could replicate the bug. This is because the custom variables, during a conversion, are read from the first party cookie supposedly passed to the request. We could change the code to read custom variables from the visit and set them in the conversion, but this would add overhead for all requests.

Therefore in this case we won't fix (for now, might re-consider later), and to work around this limitation please set the custom variables again before making the purchase / conversion.

@mattab commented on September 28th 2011

Well it's not a wontfix, since I now confirm that it should be copied into conversions, sorry for the comment above ;)

@mattab commented on September 28th 2011

(In [5251]) Fixes #2564 - now copying custom variables from the visit when custom variables not passed in the Goal conversion (or ecommerce) tracking request (eg. when request comes from a script in the backoffice)

@mattab commented on December 16th 2012

Milestone 1.8.x Piwik 1.8.x deleted

This issue was closed on December 16th 2012
Powered by GitHub Issue Mirror