Most of the created contacts are determined to be from offline sources. Want to change this.

Highlighted
New Contributor

Most of the created contacts are determined to be from offline sources.

Is there a way to overwrite this?

スクリーンショット 2020-02-10 12.24.43.png

スクリーンショット 2020-02-10 12.29.02.png

We want to analyze impact of 

Reports > analytics tool > Contact analytics

We want to analyze the impact of our advertising effectiveness using Contact dashboard which is located at Reports > analytics tool > Contact analytics 

 

my code will 

 

⬇︎here is my application action.

Frontend is React SPA. Backend API Service is Ruby on Rails.

 

1. Users come my LP by some method. (Advertise, Organic search, direct link, ...)

2. Move from LP to React SPA.

3. Users fill a signup form and submit form. handleSubmit method is called. this method send params to backend API.

4. In backend, create Hubspot::Contact and Hubspot::Company

5. handleSubmit method get return value from API.

6. Do `window._hsq.push(['identify', { email }])`

 

⬇︎here is my application code.

signup.tsx

handleSubmit = () => {
  axios
   .post(url, {form_params})
   .then(res => {
	if (window._hsq) {
        window._hsq.push(['identify', { email }])
    	  window._hsq.push(['trackPageView'])
      }
    })
}

users_api.rb

 

def signup
    user = User.create(user_params)

    hubspot_company = Hubspot::Company.create!(enterprise_account.name)

    hs_create_params = {
      firstname: user.name,
      company: enterprise_account.name,
      jobtitle: user.position,
      phone: enterprise_account.enterprise_phone_number,
      depertment: enterprise_account.department_name,
      adgroup: source_parameter ? source_parameter['utm_campaign'] : nil
    }
    hubspot_contact = Hubspot::Contact.create!(user.email, hs_create_params)
    hubspot_company.add_contact(hubspot_contact)
end

 

I understand that my code is created as an offline source because it creates a Hubspot contact via the API.

However, as you can see from the contact dashboard, there are some patterns that are not considered offline sources.

We want to overwrite all contacts identified as offline sources with something like: organic_search, email marketing,, etc

Is there any good way?

Thank you.

 

Reply
0 Upvotes
3 Replies 3
Highlighted
HubSpot Moderator

Hey @okodoon,

 

As per what my colleague Isaac mentioned here - https://community.hubspot.com/t5/APIs-Integrations/Original-source-set-to-quot-Offline-sources-quot/..., if you do not want original source to be populated as offline source,

 

Don't:
Use the Contacts API, as it cannot pass hutk cookie values.
Use the Events HTTP API, as it also won't pass cookies.

Do:
Use either the trackPageView or trackEvent JavaScript functions after the identify function. These will pass a hutk cookie to the new contact record.
Alternatively, use this Forms API endpoint and pass a hutk value directly in the context object.

I'd suggest for you to use Track page view or Events JavaScript API together with the identify function method.

 

Hope this helps to clarify things!

Reply
0 Upvotes
Highlighted
New Contributor

Thanks for reply.

You said

Don't:
Use the Contacts API, as it cannot pass hutk cookie values.

and

Do:
Use either the trackPageView or trackEvent JavaScript functions after the identify function. These will pass a hutk cookie to the new contact record.

As you can see from my code, I use both Contacts API in ruby and trackPageView function in react.

Is a hutk sent in this process?

please answer this.Thank you.

Reply
0 Upvotes
Highlighted
HubSpot Moderator

Hey @okodoon,

 

When using both the Identify a visitor and Track page view, this would pass a hutk cookie and this would also create a new contact if there is no existing contact with that email. It would also update contact if there's existing contact tie to that email. 

 

Hence, you do not need to call the Contacts API in ruby again to create the contact. 

 

If you'd like to pass custom properties, you can do so by sending the custom properties via the Identify a visitor function.

 

/*
This example sets the email,
as well as a custom property favorite_color
*/
var _hsq = window._hsq = window._hsq || [];
_hsq.push(["identify",{
    email: getParameterByName("email"),
    favorite_color: 'orange'
}]);
Reply
0 Upvotes