Add Google Custom Search to WordPress Blogs - Configuring Custom Search Using Your Google AdSense Account
(Page 2 of 4 )
The most important requirement before you can use Google Custom Search Engine is that you need to have an approved Google AdSense publisher account:
Once you have a Google AdSense publisher account, the next thing you need to do is log in to it, and follow the procedures below:
Step 1: Once you are logged in, click "AdSense Setup."
Step 2: Under AdSense, you will see four different products: AdSense for Content, AdSense for Search, AdSense for Feeds and AdSense for Domains. Click "AdSense for Search."
Step 3: On the next page, you will need to enter configuration options for your Google Custom Search. Follow the settings below:
- Under "Search Type," select "Only sites I select," because you would only need Google to return the search results from your blog only and NOT include other domains.
- Under "Selected Sites," enter the domain name of your blog. Exclude "http://" and "www". Only include the domain name. For example, if my blog is http://www.php-developer.org/ , I will only enter under "Selected Sites": php-developer.org
- Leave optional keywords blank.
- Set "Site Language" to your own preference ("English" for example).
- Leave the site encoding at default.
- Set "Country or territory for Google domain" to your own preference ("United States" for example).
- Under "Custom Channel," check "Automatically create new channel."
- Check "Use SafeSearch."
Step 4: Click "Continue" and in the "Look and Feel" section, select the default plain white watermark.
In Text box Length, enter the number of characters which you would need your text box to have. You can use the Firefox Firebug tool to measure certain widths in pixels in your actual blog, and then convert those pixels to a number of characters using the equation:
Text Box Length = (0.166*(Width in Pixels)) - 3.6667
This technique will prevent you from overstating or underestimating the number of characters needed for your text box, and you can easily estimate the text box length in pixels (using Firebug). For example, if I would like my text box to be 208 pixels wide, then the number of required characters:
Text box length = (0.166* (208)) - 3.6667 = 30.813 ~ 31
Below is the screen shot of this configuration:
Step 5: In the next step, Google will ask you how you will configure the "opening of search results page." Select "Open results within my own site." And then in the text box, enter the URL where you would like to output your search result. Since you are using WordPress, the URL format for search result will be:
The path "thisisthenameofyoursearchresultpage" will need to be created as "page" in WordPress. You will need to create a user friendly name. For example, in my blog I use "searchresultpages." So the URL that I need to enter will be:
Step 6: Under "Enter width of results area," you will need to enter a width that is less than the post width used by your current WordPress template. This will avoid template distortion. You can use Firebug: http://getfirebug.com/. Below is the screen shot, using measurements:
The WordPress width is around 628 pixels, so the suggested search result width to be used by custom search should be less than 628 pixels (something like 600 pixels is fine).
Step 7: Select your preference in "Ad location." For best results, "Top and Bottom" is recommended.
Step 8: Adjust the look and feel of your ads (background colors, font colors, etc), to exactly match with your existing WordPress template background. For example, if your theme background is white, it is also best to use white as the ads' background, and blue for the hyperlinks. If you are done, click continue.
Step 9: Assign a name to your custom search engine. Finally, click "Submit and Get Code."
The configuration is complete.
More Blog Help Articles
More By Codex-M