IP Address Pulling from Server Instead of Contact

contacts
forms

#1

I am using the Forms API to get Contacts from an externally hosted form. The IP address that is being pulled for contacts is the IP address of the website server and I get this notification on each Contact: “Some of this contact’s activity has been excluded based on their IP address. Learn more.” I had our developer add: “ipAddress”:x to the parameters but it has not changed anything. Any help or advice would be amazing.


IP Address not being pulled from server and not ipAddress
#2

Hi @JamesArbogast,

Just to make sure I’m understanding, are you including the ipAddress: xxxxxx in the hs_context parameter? If that’s not included properly, the IP address will be set to the IP of the system making the request to the Forms API, which is likely your server.


#3

Yes, that is where it was included. It doesn’t seem to have changed anything.


#4

Hi @JamesArbogast,

Can you direct message me with a link to the corresponding form in HubSpot? Additionally, how are you populating the ipAddress field?


#5

Hi @Derek_Gervais,

I messaged you the link. I am not sure exactly how it is populated, I am not the one who implemented the code, I work on the marketing end. I will have to get back to you on that.


#6

https://app.hubspot.com/forms-two/3454910/editor-two/0237b549-32d0-42da-87cb-3ee060eb1243/edit


#7

Was there any resolution on this?


#8

Hi @Peter_Keogh,

I believe the IP address wasn't properly included in the hs_context parameter.


#9

Hi @Derek_Gervais!

Would it be possible to look into these 2 examples and tell me if I messed up something?

https://app.hubspot.com/forms-two/2900997/ef2c982c-8e3c-4213-b38c-4e55c6af8e91/submissions/bf080069-1a56-44f6-bf68-5ebdbde7449f

https://app.hubspot.com/forms-two/2900997/ef2c982c-8e3c-4213-b38c-4e55c6af8e91/submissions/fcb9a5b3-0db1-46a8-a215-12d1249ea83f

I'm facing the same problem with IP address not populating correctly but I'm sure I've included the ipAddress in the hs_context parameter.


#10

Hi @batjaa,

The contact's IP address properties are matching up with the values I'm seeing in the hs_context fields for those submissions. I'm also not seeing any other data appearing in the hs_context data for this form. Are you sure that the hs_context fields are being properly formatted? Do you have an example of a raw request you're making to the forms API, so that I can take a closer look?


#11

I'm using ryanwinchester/hubspot-php and overriding the Froms class. Looks like it's still not sending the hs_context params.

This is what I have now:

public function submit($portal_id, $form_guid, $form = [])
    {
        $form['hs_context'] = [
            'hutk'      => $this->request->cookie('hubspotutk'),
            'ipAddress' => $this->request->getClientIp(),
        ];

        $endpoint = "https://forms.hubspot.com/uploads/form/v2/{$portal_id}/{$form_guid}";

        $options = [
            'form_params' => $form,
        ];

        return $this->client->request('post', $endpoint, $options, null, false);
    }

this is one of the latest submissions.


#12

You can find another submission I'm testing here.

Made that request using postman, though I've included hs_context it's still not showing up. Does the hs_context have to include all the the properties?


#13

Hi @batjaa,

Apologies, I'm not particularly familiar with PHP. How does the final hs_context field look? It's supposed to be a JSON object, but it appears above like it might be an array? Here's an example hs_context:

{
    "hutk": "60c2ccdfe4892f0fa0593940b12c11aa", 
    "ipAddress": "192.168.1.12", 
    "pageUrl": "http://demo.hubapi.com/contact/", 
    "pageName": "Contact Us", 
    "redirectUrl": "http://demo.hubapi.com/thank-you/"     
}