[BETA] Remapping data

🚧

This feature is currently in beta

Cloud Import is currently in closed beta and not adding new projects.

  • To stream data into Mixpanel, check out our Import API
  • To import data from Google Cloud Storage into Mixpanel, check out our GCS guide
  • To connect Mixpanel to your data warehouse, check out our Census Integration

Background

When using Cloud Import to import data into Mixpanel, there are specific requirements for how the data should be structured. If your data is not already in the Mixpanel format, you can define a remapping when configuring your Cloud Import job. We currently support remapping for Events, People and Groups.

Please refer to Data Preparation Guide for more details on the expected values of each attribute

Remap Event

The following required attributes can be remapped. Attributes marked as ‘required’ are mandated to be specified in the property_map, even if no remapping is done.

  • event_name (required)
    Name of the event (ex: “Signup”)

  • time (required)
    Timestamp for the event.

  • distinct_id (required)
    Unique identifier for the user.

  • $insert_id (optional)
    Used for identification and deduplication of the event.

  • ip (optional)
    IP of the device.

Example Property Remap:

property_remap: {
    "$insert_id": "iid",
    "time": "ts",
    "event_name": "ev",
    "ip": "ip",
    "distinct_id": "id"
}

Example of valid event with above property map:

{
      "iid": "ae4094aa-2e7b",
      "ts": 1585744507,
      "ev": "Ring acquired",
      "ip":"168.212.226.204",
      "id": "sauron" 
}

Remap People

The following required attributes can be remapped. Attributes marked as ‘required’ are required to be specified in the property_map, even if no remapping is done.

  • $distinct_id (required)
    Unique identifier for the user.

Example Property Remapping:

property_remap: {
     "$distinct_id": "id"
}

Example of valid event with above property map:

{
    "id": "Sméagol",
    "race": "Hobbit",
    "alilas": "Gollum",
    "name": "Sméagol",
    "email": "[email protected]"
}

Remap Group

The following required attributes can be remapped. Attributes marked as ‘required’ are required to be specified in the property_map, even if no remapping is done.

  • $group_id (required)
    Group identification.

  • $group_key (required)
    Key for group. All events need to have a defined group key on them in order to be attributed to a group

Example Property Remapping:

"property_remap": {
    "$group_key": "key",
    "$group_id": "id",
}

Example of valid event with above property map:

{
    "key": "Company",
    "id": "Mixpanel",
    "Address": "1313 Mockingbird Lane"
}

Sample data

"property_remap": {
    "time": "time",
    "event_name": "ev",
    "distinct_id": "distinct_id"  
}
{"ev": "Birth", "distinct_id": "Isildur", "time": 1601427723}
{"ev": "Birth", "distinct_id": "Sméagol", "time": 1601522222}
{"ev": "Birth", "distinct_id": "Bilbo", "time": 1601629423, "location": "Shire"}
{"ev": "Birth", "distinct_id": "Frodo", "time": 1601706584, "location": "Shire"}
{"ev": "Death", "distinct_id": "Sauron", "time": 1601431446, "location": "Mount Doom", "cause": "homicide"}
{"ev": "Death", "distinct_id": "Isildur", "time": 1601384521, "location": "Gladden Fields", "cause": "homicide"}
{"ev": "Death","distinct_id": "Sméagol", "time": 1601814444, "location": "Mount Doom", "cause": "accident"}
{"ev": "Ring Acquired", "distinct_id": "Sauron", "time": 1601251200, "location": "Mount Doom"}
{"ev": "Ring Acquired", "distinct_id": "Isildur", "time": 1601431446, "location": "Mount Doom", "previous_ring_bearer": "Sauron"}
{"ev": "Ring Acquired", "distinct_id": "Sméagol", "time": 1601559543, "location": "Gladden Fields", "previous_ring_bearer": "Déagol"}
{"ev": "Ring Acquired", "distinct_id": "Bilbo", "time": 1601661989, "location": "Misty Mountains", "previous_ring_bearer": "Sméagol"}
{"ev": "Ring Acquired", "distinct_id": "Frodo", "time": 1601720421, "location": "Shire", "previous_ring_bearer": "Bilbo"}
{"ev": "Ring Acquired", "distinct_id": "Sméagol", "time": 1601813532, "location": "Mount Doom", "previous_ring_bearer": "Frodo"}
"property_remap": {
    "$distinct_id": "distinct"  
}
{"distinct": "Sauron", "race": "Ainur", "kingdom":"Mordor", "name": "Sauron", "email": "[email protected]"}
{"distinct": "Isildur", "race": "Men", "kingdom": "Gondor", "name": "Isildur", "email": "[email protected]"}
{"distinct": "Sméagol", "race": "Hobbit", "alilas": "Gollum", "name": "Sméagol", "email": "[email protected]"}
{"distinct": "Bilbo", "race": "Hobbit", "family": "Baggins", "name": "Bilbo Baggins", "email":"[email protected]"}
{"distinct": "Frodo", "race": "Hobbit", "family": "Baggins", "name": "Frodo Baggins", "email":"[email protected]"}
"property_remap": {
     "$group_key": "key",
     "$group_id": "id",
}
{"key": "d1b6d2e0-1330-4ad6-b520-d948ede3b1a7","id": "Gangnam style", "Genre": "Pop","hashtags": "amazing"}
{"key": "d1b6d2e0-1330-4ad6-b520-d948ede3b1a7","id": "Summer of 69", "Genre": "Pop"}
{"key": "d1b6d2e0-1330-4ad6-b520-d948ede3b1a7", "id": "Summer of 69", "value": ["Genre"]}
{"key": "d1b6d2e0-1330-4ad6-b520-d948ede3b1a7","id": "Gangnam Style", "hashtags": "amazing"}
{"key": "d1b6d2e0-1330-4ad6-b520-d948ede3b1a7","id": "Gangnam Style", "hashtags": ["spectacular", "crazy"]}
{"key": "d1b6d2e0-1330-4ad6-b520-d948ede3b1a7","id": "WAP",  "Genre": "Pop","hashtags": "amazing"}

Did this page help you?