首页 文章

GoogleTagManager警告:Builder中的意外类型:(null)

提问于
浏览
5

我正在使用GoogleTagManager来实施增强型电子商务(Google Analytics)我尝试将以下dataLayer推送到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}]}}}];

这是Google代码管理器教程中的示例数据 . 但是,在尝试向Google发送匹配时,我收到以下警告消息 .

GoogleTagManager warning: Unexpected type in Builder: (null)

我使用的数据类型是NSNumber(价格[doube],收入[double]和数量[int])和其他的NSString .

以上数据类型适用于其他电子商务标签,如“AddToCart”,“结帐”等 . 但“购买”无法正常工作..

任何人都可以建议其他什么可以尝试?

1 回答

  • 2

    我不久前遇到了这个问题 . 它看起来像是与以前的电子商务冲突 .

    在您发送购买活动之前,请尝试清除电子商务对象

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

    这对我来说很有用

相关问题