Detect if Google Analytics eCommerce Tracking is enabled via Google Analytics API
By default, Google Analytics disables eCommerce Tracking.
Is it possible to check, via the Google Analytics Data Export API, whether or开发者_JAVA技巧 not e-Commerce Tracking is enabled in the account in question?
As far as I can tell, there is no way to detect solely if it is turned on.
You can checkout the XML responses that the Google Analytics APIs provide: http://ga-api-http-samples.googlecode.com/svn/trunk/src/ ; it does not appear that any of them expose the actual setting.
The one way that I've detected it in one of my apps is to simply open up the date range as far back as possible and check the count transactions (Metric: ga:transactions
, no Dimension necessary). If that's greater than 0, eCommerce Transactions are enabled. However, if transactions are equal to 0, it could mean that eCommerce is enabled but not in active use.
Fun fact: You can actually use eCommerce Tracking without enabling it; Google Analytics will collect and preserve the data; once you enable it, all of your priorly sent eCommerce data will be there. Bizarrely, it seems that the option to enable or disable eCommerce Tracking is really just a UI setting, rather than a real option.
It would had more chance to be in the Google Analytics Managment API, but I can't see it either http://code.google.com/apis/analytics/docs/mgmt/mgmtFeedReference.html
Well have a look at: http://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/profiles/list
and look at: eCommerce tracking = {$profile->getECommerceTracking()} Enhanced eCommerce Tracking = {$profile->getEnhancedECommerceTracking()}
精彩评论