# Can't use data from Segment

**URL:** <https://community.hubspot.com/t/cant-use-data-from-segment/19152>\
**Category:** APIs & Integrations\
**Tags:** workflows, events\
**Created:** [March 2, 2020, 6:23pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152 "2020-03-02T18:23:00Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![OtavioCapila](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/otaviocapila/32/38963_2.png) [@OtavioCapila](https://community.hubspot.com/u/OtavioCapila)\
**Post date:** [March 2, 2020, 6:23pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/1 "2020-03-02T18:23:00Z")

</div>

Hello folks!  
I’m sending some data from Segment to Hubspot, with a new custom event that I’ve created previously. I’ve created a new property for my contacts too, but when the event is tracked in Segment and dispatched for Hubspot, that specific value isn’t fulfilled on contact’s profile.

I’m sending an event with a property named _last\_blog\_created_ and a new property with the same name(the internal one).

My purpose here it’s to use that value and append it on an e-mail that my contact will receive when this event is fired.

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [March 3, 2020, 2:41am UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/2 "2020-03-03T02:41:25Z")

</div>

Hey @OtavioCapila,

Do you mind sharing more details on how you’re tracking event? Are you using the [Events JavaScript API](https://developers.hubspot.com/docs/methods/tracking_code_api/javascript_events_api)?

If so, could you sharing with me a snippet of the code that you’re using? Additionally, can I confirm that your HubSpot portal ID is 355xxx?

---

<div class="post-metadata">

**Author:** ![OtavioCapila](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/otaviocapila/32/38963_2.png) [@OtavioCapila](https://community.hubspot.com/u/OtavioCapila)\
**Post date:** [March 4, 2020, 12:21pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/3 "2020-03-04T12:21:12Z")

</div>

Hi @WendyGoh,  
I’m sending this code from segment to Hubspot

```auto
analytics.track({
 userId: 'FAKE_VALUE',
 event: 'Blog Ready',
 properties: {
 blogId: 'FAKE_VALUE',
 email: 'FAKE_VALUE',
 last_blog_created: 'FAKE_VALUE',
 userId: 'FAKE_VALUE'
 }
});

```

I’ve replaced the original values with FAKE\_VALUE for security reasons.

As you can see in the snippet above, I’m sending a property called “last\_blog\_created” with a URL, and I’ve created a property for all contacts with the same name.

When I dispatch that event from Segment to Hubspot, my workflow is triggered, and an email is sent to the contact. But the value of “last\_blog\_created” on the contact profile isn’t fulfilled with the value that comes from the event.  
I’m not using the [Events JavaScript API](https://developers.hubspot.com/docs/methods/tracking_code_api/javascript_events_api), and yes, my Hubspot ID is 355XXX.

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [March 5, 2020, 2:40am UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/4 "2020-03-05T02:40:10Z")

</div>

Hey @OtavioCapila,

Thanks for the further clarification!

When looking at the segment documentation here: [HubSpot Destination | Segment Documentation](https://segment.com/docs/connections/destinations/catalog/hubspot/) - It looks like if you’d like to set HubSpot contact properties on the track function, you’d need to add it in the _context.traits_ object. E.g.

```auto
analytics.track(
 user_id='YOUR_USER_ID',
 event='Bought Item',
 properties={
 'email': 'peter@initech.com',
 },
 context={
 'traits': {
 'firstname': 'Peter',
 'lastname': 'Gibbons'
 }
})

```

Could you try and see if this works?

---

<div class="post-metadata">

**Author:** ![OtavioCapila](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/otaviocapila/32/38963_2.png) [@OtavioCapila](https://community.hubspot.com/u/OtavioCapila)\
**Post date:** [March 5, 2020, 12:14pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/5 "2020-03-05T12:14:13Z")

</div>

Hi @WendyGoh,

Thanks for replying 😃

I’ve found this solution yesterday and it worked nicely. So I’ll mark your reply as the solution.

Thanks for your help. See ya 🤘

---

<div class="post-metadata">

**Author:** ![estrada9166](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/estrada9166/32/102498_2.png) [@estrada9166](https://community.hubspot.com/u/estrada9166)\
**Post date:** [March 5, 2020, 6:27pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/6 "2020-03-05T18:27:28Z")

</div>

Can you share a snippet of your code? I had been trying this but there’s no update on the Hubspot side.

Im doing

```auto
analytics.track({
 userId: 'FAKE_VALUE',
 event: 'Custom event',
 properties: {
 email: 'FAKE_VALUE',
 },
 context: {
 traits: {
 firstname: 'FAKE_VALUE',
 },
 },
 timestamp: new Date(),
})

```

But it seems not to work,

Also @WendyGoh, how can I get the name of a field to update, for example I would like to update **Opted out of email marketing information,** I found the internal name but it seems it doesn’t work either using **.identify**

BTW, Im not using analytics.js Im using analytics-node

Thanks

---

<div class="post-metadata">

**Author:** ![OtavioCapila](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/otaviocapila/32/38963_2.png) [@OtavioCapila](https://community.hubspot.com/u/OtavioCapila)\
**Post date:** [March 5, 2020, 7:03pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/7 "2020-03-05T19:03:37Z")

</div>

@estrada9166 I’m doing exactly like you, and its working.

To get the name of a specific field, you must click on the property to see its settings and click at that blue button on the right side of the input. There you’ll see the name you will pass to Segment in order to update it.

 ![image.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/5/1/5189e7e0e945edc49ba66a6b8c818b8073530bba.png)

---

<div class="post-metadata">

**Author:** ![estrada9166](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/estrada9166/32/102498_2.png) [@estrada9166](https://community.hubspot.com/u/estrada9166)\
**Post date:** [March 5, 2020, 7:05pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/8 "2020-03-05T19:05:03Z")

</div>

@OtavioCapila Im gonna continue trying! Thank you!

For the moment no result.  
 ![16x16_smiley-frustrated.png.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/a/ab2bb3944725823b01ce5eab7e566f43d37ac1b8.png)

---

<div class="post-metadata">

**Author:** ![OtavioCapila](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/otaviocapila/32/38963_2.png) [@OtavioCapila](https://community.hubspot.com/u/OtavioCapila)\
**Post date:** [March 5, 2020, 7:08pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/9 "2020-03-05T19:08:59Z")

</div>

@estrada9166 Just remember that inside traits object, the property must match the internal name of a property on Hubspot.

So if the property on Hubspot has an internal name of something like “user\_lastname”, the traits object must be something like this →

```auto
traits:{
   user_lastname:"FAKE_VALUE",
}

```

---

<div class="post-metadata">

**Author:** ![estrada9166](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/estrada9166/32/102498_2.png) [@estrada9166](https://community.hubspot.com/u/estrada9166)\
**Post date:** [March 5, 2020, 7:13pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/10 "2020-03-05T19:13:38Z")

</div>

@OtavioCapila yeah, I had try with the default values like lastname, firstname and stuff like that but doesn’t work eiter.

If I try the identify with those fields it works fine

---

<div class="post-metadata">

**Author:** ![estrada9166](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/estrada9166/32/102498_2.png) [@estrada9166](https://community.hubspot.com/u/estrada9166)\
**Post date:** [March 5, 2020, 9:59pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/11 "2020-03-05T21:59:07Z")

</div>

@OtavioCapila do you have HubSpot Enterprise account?

---

<div class="post-metadata">

**Author:** ![SGreco](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/sgreco/32/68963_2.png) [@SGreco](https://community.hubspot.com/u/SGreco)\
**Post date:** [September 10, 2021, 12:54pm UTC](https://community.hubspot.com/t/cant-use-data-from-segment/19152/12 "2021-09-10T12:54:06Z")

</div>

Hello!

I have been using this context\>traits technique for a while now, but we discovered recently that the information is no longer being persisted in contacts profile. Other destiantions do recieve the data, but not HubSpot.

Any of you guys encountered this problem before? I’m sure we didn’t change a line of code, and specially that other distanations seem to be working properly.
