1

Mixpanel を Android アプリに統合しようとしています。イベントの追跡などに関しては問題なく機能しますが、問題は、すべてのイベントがレポート内の 1 人のゲストの下に記録されることです。mixpanel.identify()との両方で identify() を呼び出しmixpanel.getPeople().identify()、コードは次のようになります。

    MixpanelAPI mixpanel = MixpanelAPI.getInstance(this, MIXPANEL_TOKEN);
    MixpanelAPI.People people = mixpanel.getPeople();
    people.identify("666");
    people.set("first_name", "john");
    people.set("last_name", "smith");

    JSONObject props = new JSONObject();
    try {
        props.put("Gender", "Male");
        props.put("Plan", "Premium");
    } catch (JSONException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }


    mixpanel.track("Plan selected", props);
    mixpanel.flush();       

その追跡イベントが何回送信されても​​ (identify の値を変更して再度追跡しても)、すべてのイベントはランダムなゲスト名で追跡されます: Guest #74352

4

1 に答える 1

5

アクティビティ フィードでイベントをユーザーの名前に関連付ける場合は、$first_nameand $last_name(ドル記号を含む) をプロパティとして使用します。Android ライブラリは、ストリーム レポートでの名前のタグ付けを直接サポートしていませんがmp_name_tag、イベントにスーパー プロパティを追加することで、そこにも名前を付けることができます。したがって、コードを次のようにしたい場合があります。

MixpanelAPI mixpanel = MixpanelAPI.getInstance(this, MIXPANEL_TOKEN);
MixpanelAPI.People people = mixpanel.getPeople();

// Using the same id for events and people updates will let you
// see events in the people analytics activity feed.
mixpanel.identify("666"); 
people.identify("666");

// Add the dollar sign to the name properties
people.set("$first_name", "john");
people.set("$last_name", "smith");

JSONObject nameTag = new JSONObject();
try {
    // Set an "mp_name_tag" super property 
    // for Streams if you find it useful.
    nameTag.put("mp_name_tag", "john smith");
    mixpanel.registerSuperProperties(nameTag);
} catch(JSONException e) {
    e.printStackTrace();
}

JSONObject props = new JSONObject();
try {
    props.put("Gender", "Male");
    props.put("Plan", "Premium");
} catch (JSONException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

mixpanel.track("Plan selected", props);
mixpanel.flush(); 
于 2013-07-18T19:41:21.653 に答える