O'Reilly logo

Learning Storm by Anand Nalya, Ankit Jain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extracting the searched keyword

This section explains how you can extract the searched keyword from the referrer URL. Suppose a referrer URL is https://www.google.co.in/#q=learning+storm. We will pass this referrer URL to our KeywordGenerator class and the output will be learning storm. By extracting the keyword to be searched, we can easily identify the search keyword that users are using to reach our site. Let's perform the following steps to extract the keyword from the referrer URL:

  1. We will create a KeywordGenerator class in the com.learningstorm.stormlogprocessing package. This class contains the logic to generate the keyword from the referrer URL. The following is the source code of the KeywordGenerator class:
    /** * This class takes the referrer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required