🧩 How can I map JSON product event data to a profile in Tracardi?

Having trouble mapping JSON event data to profiles in Tracardi? This post covers how to set up event-to-profile mapping, handle unique keys and tips for managing the automation builder.

🧩 How can I map JSON product event data to a profile in Tracardi?

This question was asked on the Tracardi slack #dev-help channel.

Hey everyone, I'm new to Tracardi and was hoping to get some help. I'm trying to set up an event where "product" is a full JSON object, but when I check the profile, I don’t see anything getting mapped. Do I need to set up something special for this to work?
{
  "product": {
    "id": "12345",
    "name": "Widget",
    "price": 1200,
    "category": "Gadgets"
  }
}

Sample of my JSON for product event.

To troubleshoot, the Tracardi community responded with a few clarifying questions to narrow down the issue. They then recreated the scenario in a test environment to find a solution.

As a result, the following strategy was suggested:

1 - Use a tracking code with properties that contain the payload for the profile:

<script>
  window.tracker.track("product2profile", {
    "properties": {
      "product": {
        "id": "12345",
        "name": "Widget",
        "price": 1200,
        "category": "Gadgets"
      }
    }
  });
</script>

Example of tracking code for the product2profile event.

2 - Use event-to-profile mapping: In the event type setup, configure the following:

  • Trigger condition: When event type equals product2profile
  • Mapping schema: Profile fields are mapped from event properties as shown: profile@aux = [email protected]

After setting up the above, the product details began successfully mapping to the profile.

Key Considerations:

  • One question raised during the discussion was about the importance of having a key for uniqueness when mapping JSON payloads to a profile. For instance, if you're dealing with multiple products, ensure the product id or another unique identifier is part of the event to avoid overwriting profile data.
  • Another common question that came up was how to delete items in the automation builder. To do this, simply select the item you wish to remove and use the function + delete key on your keyboard (Mac).

I hope this helps others facing similar issues!


We'd love to hear your thoughts!

Do you have any additional tips or strategies for handling complex JSON payloads or ensuring data uniqueness?