Android上的谷歌分析无法正常工作

时间:2015-11-01 07:47:05

标签: android google-analytics

我正在尝试使用交易/购买活动,但我似乎无法让它发挥作用。 另外,我正在使用Eclipse,据我所知,最新的sdk(v4)不支持它。但我只需要发送已经购买的价格。

private static Tracker getTracker(){
        return GoogleAnalytics.getInstance(App.getContext()).getTracker(TRACKING_ID);
    }

HitBuilders.TransactionBuilder builder= new HitBuilders.TransactionBuilder();
        builder.set( "TransactionId", timeString );
        builder.set( "Revenue", Double.toString( orderSum ) );
        builder.set( "Affiliation", "Android" );
        builder.set( "Shipping", "0" );
        builder.set( "Tax", "0" );
        getTracker().set( "&cu", "USD" ); 
        getTracker().send( builder.build() );

        HitBuilders.ItemBuilder itemBuilder= new HitBuilders.ItemBuilder();
        itemBuilder.set( "TransactionId", timeString );
        itemBuilder.set( "Name", Double.toString( orderSum ) );
        itemBuilder.set( "SKU", "Android" );
        itemBuilder.set( "Price", Double.toString( orderSum ) );
        itemBuilder.set( "Quantity", "1" );
        getTracker().set( "&cu", "USD" ); 
        getTracker().send( builder.build() );

    }

0 个答案:

没有答案