GoogleTagManager Warning: Unexpected type in Builder: (null)

I am using GoogleTagManager to implement advanced e-commerce (Google Analytics) I tried to click below DataLayer on 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 sample data from the Google Tag Manager tutorial. However, when you try to send requests to Google, the following warning message appears.

 GoogleTagManager warning: Unexpected type in Builder: (null) 

The data type that I use is NSNumber (price [doube], revenue [double] and quantity [int]) and NSString for others.

The above data types work properly for other ecommerce tags such as "AddToCart", "Checkout", etc. However, the "Purchase" does not work.

Can anyone suggest what else you can try?

+5
source share
1 answer

I ran into this problem a while ago. it looks like a conflict with previous e-commerce.

before sending the purchase event try to clear the e-commerce item

 [self.tagDataLayer push:@{@"ecommerce":[NSNull null]}]; 

it worked for me

+2
source

All Articles