Digital.gov Guide

Optimizing site search with Search.gov

Search.gov is a configurable search engine built by the government, for the government, with the government. 
Illustration of analytics and search graphics inside a large gear icon.

Set up your search experience

Welcome! We are glad you are getting started using Search.gov.

You can use Search.gov to power the search results on your federal website at no cost. To use Search.gov, the first thing you need to do is to create an account.

Create an account

Search.gov uses Login.gov to allow you to sign in to your account safely and securely. Follow the prompts to create a new Login.gov account or sign in with your existing Login.gov account.

If you already have an account with Search.gov, you can sign in to manage your account and analyze and optimize your search experience.

To create a new Search.gov account, go to https://search.usa.gov/signup.

You must use your official government email account, in most cases a .gov or .mil account.

Then, check your inbox for an email from Login.gov to verify your email.

In addition to your password, Login.gov requires that you set up at least one authentication method to keep your account secure. Learn more about the authentication methods on Login.gov.

If you run into any issues setting up your Login.gov account, visit their help center for more information on how to get started with Login.gov.

Troubleshooting tips

Reset your password

Login.gov manages all passwords. If you forgot your password, follow the tips on how to reset your password on Login.gov.

Connect your account

If your Login.gov account is associated with both your personal and government email accounts, you might need to fix which account is connected to Search.gov.

Sign in to Login.gov and then check the settings under Connected Accounts.

It should list your .gov or .mil account for Search.gov. If it lists your personal .com account, follow the prompts to change it to your government email account.

Then, sign in to Search.gov again using your updated Login.gov account settings.

Go live with Search.gov

After you create an account, follow these five steps to go live with Search.gov.

Step 1. Create a new site

To customize the search experience for your website, you need to create a new site in the Admin Center. Start by entering some basic details about your site, including its homepage and display name.

Step 2. Add domains

After creating the new site, you need to add the domains for the content you want included in the search results. You can add one or more domains in the Content section of the Admin Center.

Review how to optimize your content for more information on adding domains.

Step 3. Manage other content (optional)

Search.gov offers several other ways to manage the content on your results page. You can set up collections and best bets in the Content section of the Admin Center.

  • Use collections to search a narrower or broader scope than the default results page.
  • Use best bets to promote specific pages at the top of your search results.

Review how to optimize your content for more information on using collections and best bets.

Step 4. Design the results page

There are several options you can use to make the results page match the design of your website. You can set fonts and colors and upload your logo in the Display section of the Admin Center.

You can also add header links to support navigation between your website and the search results page to create a more seamless experience.

If you created any collections, you can select the option to display them on the Display Overview page in the Admin Center.

Use the Preview option in the Admin Center to preview the design.

Review how to design your results page for more information.

Step 5. Connect your search box to Search.gov

When you are ready to go live, you will need to modify the form code for the search box on your website.

Update the form code

Use form code provided in the Activate section of the Admin Center.


<form accept-charset="UTF-8" action="https://search.usa.gov/search" 
id="search_form"method="get">
    <div style="margin: 0;padding: 0;display: inline;"> 
        <input name="utf8" type="hidden" value="&#x2713;"/>
    </div>
    <input id="affiliate" name="affiliate" type="hidden" value="YourSiteHandle"/>
    <label for="query">Enter Search Term(s):</label> 
    <input autocomplete="off" class="usagov-search-autocomplete" id="query" 
    name="query" type="text"/>
    <input name="commit" type="submit" value="Search"/>
</form>

Replace YourSiteHandle with your site handle, which you can find on sites list page in the Admin Center.

Advanced form code options

You can limit results to specific folders or subdomains by passing in a hidden value or creating a collection.

Option 1. Limit to a hidden value

You can pass a hidden value in the search form code to return results from a specific subdomain or subfolder on your site.

For example, on NPS.gov, the following hidden value would be added to limit results to only the yell subfolder.

<input type="hidden" name="sitelimit" id="sitelimit" value="www.nps.gov/yell"/>

You can see how this works by going to the Yellowstone National Park page on NPS.gov. Type any term in the search box and select the "This site" option to limit results to Yellowstone National Park only.

Option 2. Limit to collections

You can update your form code to limit the search results to collections only. You will need to make two updates to the basic form code:

  1. Change the form action to action="https://search.usa.gov/search/docs/.
  2. Add an input line, <input type="hidden" name="dc" value="###">.

Replace ### with your collection ID, which you can find in the URL when you edit your collection in the Admin Center.

 

APIs for developers

If you don’t want to use the hosted search results page, you can use the APIs, which allow you to display results within your own website.

  • Search results API. Use the search results API to receive web results, best bets, news, and videos in one JSON call.
  • Clicks API. Use the clicks API with the Search results API to send click data to Search.gov.

While using the APIs gives you more control over the look and feel of the search results, you will need a team of designers, engineers, and other digital service experts to create your search experience and maintain it over time.

Manage your users and settings

Search.gov offers several settings that allow you to manage user accounts and other general settings. You can find these settings in the Dashboard section of the Admin Center.

Manage users

After you create an account, you can add other users to your site on the Manage Users page in the Admin Center.

When you add a user, be sure to list their official government email account.

Do not add any personal email accounts (such as AOL, Gmail, and Yahoo) or group email accounts (such as webteam@example.gov). Group accounts are not supported by Login.gov.

Also, when someone leaves your team, be sure to remove their access to your site.

Manage settings

You can manage general settings on the Settings page in the Admin Center.

Fill out the display name for your site. Use your agency or program name, such as "GSA," "GSA.gov," or "General Services Administration." The public sees this display name on your search results page, including in the page title and best bets.

Also fill out the homepage URL of your website. Enter a complete address such as https://www.gsa.gov or https://tts.gsa.gov.

You can confirm your site handle, ID, and language on this page. You selected the site handle and language when you created your site. The ID was automatically assigned by Search.gov when you created your site.

After you have added a site, you may want to delete it. Use caution. This action permanently deletes your site and all of its analytics and indexes. The Search.gov team cannot restore deleted sites.