No campaign data found. Using Google Analytics v4

时间秒杀一切 提交于 2019-12-01 04:50:37

问题


I am getting this error "I/GAV4(7915): Thread[GAThread,5,main]: No campaign data found." Anyone has idea as what i going wrong ?

  • I am using android API level 20
  • Google Analytics v4
  • Android device 4.2.2
  • Constants.TRACKER_MainActivity = "MainActivity"

Note - I have masked few elements below in code.

here is my code..manifest

<application
        android:name="com.xxx.yyy.utility.Trackers"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data 
            android:name="com.google.android.gms.analytics.globalConfigResource"
            android:resource="@xml/global_tracker" />
        <activity
            android:name="com.xxx.yyy.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

tracker init

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:ignore="TypographyDashes">
  <integer name="ga_sessionTimeout">300</integer>

    <!-- Enable automatic Activity measurement -->
    <bool name="ga_autoActivityTracking">true</bool>

    <!-- The screen names that will appear in reports -->
    <screenName name="com.xxx.yyy.MainActivity">MainActivity</screenName>
    <!--  The following value should be replaced with correct property id. -->
    <string name="ga_trackingId">UA-YYYYYYY-X</string>
</resources>

Code in Activity - onCreate //Managing trackers for the app

t = ((Trackers) getApplication()).getTracker(Trackers.TrackerName.GLOBAL_TRACKER);

onResume //Sending resume to analytics

t.setScreenName(Constants.TRACKER_MainActivity);
t.send(new HitBuilders.AppViewBuilder().build());

Tracker Application Class

public class Trackers extends Application
{
    public enum TrackerName
    {
        APP_TRACKER, // Tracker used only in this
                        // app.
        GLOBAL_TRACKER, // Tracker used by all the
                        // apps from a company.
                        // eg: roll-up tracking.
        ECOMMERCE_TRACKER, // Tracker used by all
                            // ecommerce
                            // transactions from a
                            // company.
    }

    HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>();

    public synchronized Tracker getTracker(TrackerName trackerId)
    {
        if (!mTrackers.containsKey(trackerId))
        {
            GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
            if( trackerId == TrackerName.GLOBAL_TRACKER )
            {
                mTrackers.put(trackerId, analytics.newTracker(R.xml.global_tracker));
            }
        }
        return mTrackers.get(trackerId);
    }
}

回答1:


ok this thing works just fine. I was looking under Apps-overview in Google Analytics. Reports are not generated there in realtime. There is an specific tab for real-time reports under Google Analytics. This is where we need to see.




回答2:


For this make CustomReceiver and from that send intent to google CampaignTrackingReceiver in GoogleAnalyticsv4.

By this you will get CampaignFound in logs

public class CustomCampaignTrackingReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {

new CampaignTrackingReceiver().onReceive(context, intent);
}
}


来源:https://stackoverflow.com/questions/24758989/no-campaign-data-found-using-google-analytics-v4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!