# Form Api always sets the source as DIRECT\_TRAFFIC

**URL:** <https://community.hubspot.com/t/form-api-always-sets-the-source-as-direct-traffic/92375>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [October 23, 2023, 12:30pm UTC](https://community.hubspot.com/t/form-api-always-sets-the-source-as-direct-traffic/92375 "2023-10-23T12:30:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aVIDAL3](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@aVIDAL3](https://community.hubspot.com/u/aVIDAL3)\
**Post date:** [October 23, 2023, 12:30pm UTC](https://community.hubspot.com/t/form-api-always-sets-the-source-as-direct-traffic/92375/1 "2023-10-23T12:30:59Z")

</div>

hello,  
i am using the Form API to create a contact when a user registers on my Wordpress site.  
i’ve installed the wordpress plugin and checked that the tracking code is present on my website. ive also made sure a Cookie is present.  
here is the payload i send to the form API:

`{"firstname":"firstname","lastname":"lastname","email":"test@email.com","hs_context":"{\"hutk\":\"46dd4b39c44d6331766e5a30e0fc7cbd\",\"ipAddress\":\"127.0.0.1\",\"pageUrl\":\"http:\\\/\\\/mywebsite.com\\\/login\",\"pageName\":\"etape inscription\"}"}`

is there anything i can do to improve tracking?

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [October 26, 2023, 10:43pm UTC](https://community.hubspot.com/t/form-api-always-sets-the-source-as-direct-traffic/92375/2 "2023-10-26T22:43:18Z")

</div>

Hi, @aVIDAL3 👋 Thanks for your question. I don’t see any red flags with your payload formatting. One question, have you tried implementing a `window.onload` event?

```lia-code-sample
window.onload = function() {
 // Your form submission logic here
};

```

It’s challenging to know what’s causing this issue without more information or a way to test the form in-action.

Best,

Jaycee
