Original Source Drilldown is missing when submitting a form

contacts

#1

Hi! We are submitting a HubSpot form via API.

{  
       'lastname':'Tester',
       'hs_context':'{"sfdcCampaignId": "xxxxx", "hutk": "d3c5203c7eef68129e8f4f4340bd8bda", "pageName": "Sign up", "redirectUrl": "https://secure.tempoautomation.com/rfq/", "pageUrl": "https://secure.tempoautomation.com/accounts/quote-signup", "ipAddress": "199.230.10.198"}',
       'firstname':'Tester',
       'email':'xxxxxx@tempoautomation.com'
}

The contact gets created OK, the IP address is correct but when we go through Google or Twitter the source says “Direct Traffic”. If anyone from HubSpot is reading it with global access you can check out: https://app.hubspot.com/contacts/1890396/contact/1255851/ and https://app.hubspot.com/contacts/1890396/contact/1255701/

The python code does the right kind of encoding, but just for kicks here is the code:

# This data is structured per HubSpot's API docs:
# http://developers.hubspot.com/docs/methods/forms/submit_form
form_data = {
    'email': user.email,
    'firstname': user.first_name or '',
    'lastname': user.last_name or '',
    'hs_context': json.dumps({
        'hutk': cookie_val,
        'redirectUrl': request.build_absolute_uri(
            request.GET.get('next', reverse('rfq'))),
        'pageUrl': request.build_absolute_uri(),
        'pageName': 'Sign up',
        'ipAddress': ip_from_request(request) or '',
        'sfdcCampaignId': settings.SALESFORCE_RFQ_CAMPAIGN_ID or '',
    }),
}

forms_url = settings.HUBSPOT_FORMS_URL + \
    "uploads/form/v2/" + \
    settings.HUBSPOT_QUOTE_SIGNUP_FORM_PORTAL_ID + "/" + \
    settings.HUBSPOT_QUOTE_SIGNUP_FORM_GUID

try:
    # Hubspot submits this with Content-Type
    # 'application/x-www-form-urlencoded'.
    # however requests does this automatically
    # read here: http://docs.python-requests.org/en/v0.10.7/user/quickstart/
    result = requests.post(forms_url, data=form_data)
    result.raise_for_status()

except (requests.exceptions.RequestException,
        requests.exceptions.HTTPError)

#2

Hi @mikebz

The data you’re sending looks ok. I’ll take a look at those two specific contacts and reach out directly when I have more info about this.