After implementing enhanced ecommerce feature for iOS, google analytics ecommerce overview is showing zero revenue. I've implemented the Transaction measurement directly without any checkout steps. Console output prints the correct revenue value along with other variables, but after that comes "http status -1". I've launched a "Missing Ecommerce Data" notification check, but it's been already 3 days and it's still pending. Does anyone know how to resolve this issue?
I've been following official google guide on ecommerce here (Measuring Transactions section): https://developers.google.com/analytics/devguides/collection/ios/v3/enhanced-ecommerce#measuring-transactions
P.S.: Google Analytics has Enhanced ecommerce enabled, GoogleService-Info.plist is added to the project.
My code:
static func tagCheckoutFromBookingInfo(bookingInfo: BookingInfo?, discountCode: String?) {
//#if ANALYTICS
let eventData = ProductInfo()
let generalProductDict = eventData.getPayload(bookingInfo?.property, priceInfo: bookingInfo?.propertyPriceInfo(), specificInfo: nil, positionInList: nil)
let product = ecommerceProductFromGeneralProductDict(generalProductDict, discountCode: discountCode)
let builder = GAIDictionaryBuilder.createEventWithCategory(GTMEcommerceKeys.CheckoutCategory.rawValue, action: GTMEcommerceKeys.CheckoutPurchase.rawValue, label: nil, value: nil)
let action = GAIEcommerceProductAction()
action.setAction(kGAIPAPurchase)
action.setTransactionId("T123")
action.setAffiliation(GTMEcommerceKeys.CheckoutAffiliaction.rawValue)
action.setRevenue(NSNumber(double: GTMHelper.priceFromDict(generalProductDict)))
action.setCouponCode(discountCode ?? "")
builder.setProductAction(action)
builder.addProduct(product)
let build: [NSObject: AnyObject] = builder.build() as [NSObject : AnyObject]
tracker.send(build)
//#endif
}
static func ecommerceProductFromGeneralProductDict(dict: [String: AnyObject]?, discountCode: String?) -> GAIEcommerceProduct {
let product = GAIEcommerceProduct()
let productId = (dict?[GTMKeys.ProductId.rawValue] as? String) ?? ""
let productName = (dict?[GTMKeys.ProductName.rawValue] as? String) ?? ""
product.setId(productId)
product.setName(productName)
if discountCode != nil {
product.setCouponCode(discountCode ?? "")
}
if let productCategory = dict?[GTMKeys.ProductType.rawValue] as? String {
product.setCategory(productCategory)
}
product.setPrice(GTMHelper.priceFromDict(dict))
product.setQuantity(NSNumber(integer: 1))
return product
}
Console output:
2016-08-05 16:41:28.986 Belvilla[1435:339806] VERBOSE: GoogleAnalytics 3.14 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:517): Saved hit: {
parameters = {
"&_crc" = 0;
"&_s" = 3;
"&_u" = ".nteynL";
"&_v" = "mi3.1.4";
"&a" = 655...;
"&aid" = "--------------";
"&an" = Name;
"&ate" = "<null>";
"&av" = "3.4.0";
"&cid" = "f40c6c80-3ec9-43...";
"&dm" = "iPhone6,1";
"&ds" = app;
"&ea" = Purchase;
"&ec" = Ecommerce;
"&el" = "<null>";
"&ev" = "<null>";
"&idfa" = "<null>";
"&pa" = purchase;
"&pr1ca" = "Holiday home";
"&pr1cc" = "";
"&pr1id" = "XX-00-20-00";
"&pr1nm" = "Test House";
"&pr1pr" = "456.7";
"&pr1qt" = 1;
"&sr" = 640x1136;
"&t" = event;
"&ta" = "Booking";
"&tcc" = "";
"&ti" = T123;
"&tid" = "UA-.....";
"&tr" = "456.7";
"&ul" = "en-fr";
"&v" = 1;
"&z" = 740324....;
gaiVersion = "3.14";
};
timestamp = "2016-08-05 13:41:28 +0000";
}