I am using GoogleTagManager to implement enhanced e-commerce (Google Analytics) I tried pushing the below dataLayer to GTM.
[dataLayer push:@{@"event",@"purchase",
@"ecommerce": @{
@"purchase": @{
@"actionField": @{
@"id": @"T12345", // Transaction ID. Required for purchases and refunds.
@"affiliation": @"Online Store",
@"revenue": @"35.43", // Total transaction value (incl. tax and shipping)
@"tax":"4.90",
@"shipping": @"5.99",
@"coupon": @"SUMMER_SALE"},
@"products": @[ // List of productFieldObjects.
@{@"name": @"Triblend Android T-Shirt", // Name or ID is required.
@"id": @"12345",
@"price": @"15.25",
@"brand": @"Google",
@"category": @"Apparel",
@"variant": @"Gray",
@"quantity": @1,
@"coupon": @""}, // Optional fields may be omitted or set to empty string.
@{@"name": @"Donut Friday Scented T-Shirt",
@"id": @"67890",
@"price": @"33.75",
@"brand": @"Google",
@"category": @"Apparel",
@"variant": @"Black",
@"quantity": @1}]}}}];
This is the sample data from Google Tag manager tutorial. However I get the following warning message when trying to send hits to Google.
GoogleTagManager warning: Unexpected type in Builder: (null)
The data type I am using is NSNumber (price[doube],revenue[double] & quantity[int]) & NSString for others.
The above data-types work proper for other Ecommerce tags like "AddToCart","Checkout" etc.. however "Purchase" isn't working..
Can any one suggest what else can be tried?
i ran into this problem a while back. it looks to me like a conflict with the previous ecommerce stuff.
before u send the purchase event, try clearing the ecommerce object
[self.tagDataLayer push:@{@"ecommerce":[NSNull null]}];
this worked out for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With