You can integrate commute search into your UI to allow job seekers to search for jobs within a geographic area set by commute time. Commute search estimates commute time based on a user's selected transit mode and the time of day they plan to travel.
Implement commute search
Before you can implement commute search, Cloud Talent Solution must be hooked up to your UI. Follow the quickstart guides to set up Cloud Talent Solution.
Commute search uses the address data that you uploaded with your jobs during CTS implementation to calculate commute time. To enable this feature in your existing CTS UI, send a
jobs.search
request and include aCommuteFilter
object in theJobQuery.commuteFilter
field.commuteMethod
,travelDuration
,startCoordinates
, and eitherroadTraffic
ordepartureTime
are required fields.
Go
To learn how to install and use the client library for CTS, see CTS client libraries. For more information, see the CTS Go API reference documentation.
To authenticate to CTS, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.
Python
For more on installing and creating a Cloud Talent Solution client, see Cloud Talent Solution Client Libraries.
UI recommendations
Cloud Talent Solution doesn't allow searching by both distance (using the CTS location filter) commute time in the same API call. To allow job seekers to access both options, use a 2-tab approach or similar.
Modify the frontend of your application to ensure that the backend automatically populates a job seeker's relevant information into the commute filter. The backend should call the API as it would in a regular search request.
Include items in your UI:
An option to select either a distance search or commute search. For example, your Search UI could look like the sample below:
A drop-down menu of commute method options.
An option to adjust traffic conditions.
The total travel time (the maximum supported travel time is 60 minutes).
Commute start time.
The commute time information returned from the API is used to display information to the job seeker. Only relevant jobs located within the designated commute time area are returned in the results list. See the Job Search Best Practices documentation for a discussion of ways to adjust the order and number of jobs returned within this area.
Commute search results are based on historical and aggregated data rather than live traffic conditions. The
departureTime
traffic conditions are calculated from average traffic conditions at the specified time of day. TheBUSY_HOUR
/TRAFFIC_FREE
options underroadTraffic
are average traffic conditions at morning rush hour and midnight, respectively. Users receive the same commute search results no matter what time of day they send a query.
Generating a map with commute information (Recommended)
You can leverage Google Maps to generate a map based on the commute time information returned from CTS and embed it into the results returned to a job seeker. The Maps API suite has several options for displaying a map. Some Maps API options are more effective than others. For example, the Google Maps JavaScript Heatmap visualization paired with marker clustering is an effective way to visualize the relevant jobs returned to a job seeker inside the area determined by their set commute preferences. Conversely, Directions Mode does not show all jobs returned in a search request and is not a recommended option.
For more information on implementing a commute-based search, see the Commute Search how-to guide.