Capture searches done in searchbox

Discussion in 'Programming' started by pubsit1000, Sep 28, 2007.

  1. #1
    I have a basic search box from Google but I want to capture the searches made. Can you please guide me, give me a tutorial link or something ? I looked but I couldn't find a solution.

    Thank you.
     
    pubsit1000, Sep 28, 2007 IP
  2. snapcount

    snapcount Peon

    Messages:
    6
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You should be able to do this quite easily:

    1. Modify the HTML Google gives you for displaying the search box to post/get to your own script.

    2. Your script takes the data sent, saves it to the database.

    3. Your code then posts the original form data to the url Google gave you. You could use cURL or LWP ( not sure what language you hack in ) to do this.

    4. Your script then returns the output from your cURL/LWP to the user.

    One thing you would want to do for sure is to set the user-agent to that of a browser and not leave it as the default. Google probably checks... in fact you may want to setup an array of common browser UA sigs and randomly pick one on each request to make it look more legit to them.

    I would definitely make sure you are still getting your $$$ for paid clicks when you are done cause that would be undesirable =) Also, this is almost certainly against the TOS so if they catch you doing it you'll likely get your AS account banned but I could be wrong.
     
    snapcount, Sep 29, 2007 IP
  3. mac

    mac Peon

    Messages:
    76
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Google's terms may not allow you to modify their search, but if you do, you can try the solution I outlined on this thread.
     
    mac, Sep 30, 2007 IP
  4. pubsit1000

    pubsit1000 Peon

    Messages:
    293
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'm not using this for AdSense. I have some parked LLLL domains that receive traffic but nobody is clicking. So I just want to place a simple page with a big search box for a month to see what people are looking when they arrive.

    mac: if I use your method where will I see the stats ? In what menu ?
     
    pubsit1000, Sep 30, 2007 IP
  5. mac

    mac Peon

    Messages:
    76
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Sorry about the late reply! I set up email notification on this thread so I'll get any responses.

    You sill see the results as URLs in Analytics. In other words, the script tells analytics you manually add a 'view' to a specied URL. What this does is allow you to see your search results as URLs from your visitors. This means that you will see a "URL" of say, "/search/some search string" that shows up in analytics. Note that analytics is usually a couple hours behind, so give it some time then check.

    I took a look at your code and you should change the searchText to type, which is the id of the search text box (or the other way around, change the text box ID to searchText, it doesn't really matter as long as they match). The other thing you might want to do is put the Google script code that loads the analytics (not the one that calls urchinTracker();) in the head of your HTML.

    Hope that helps! Let me know if you need any further assistance.
     
    mac, Oct 2, 2007 IP
    pubsit1000 likes this.
  6. pubsit1000

    pubsit1000 Peon

    Messages:
    293
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks mac, it's a great and simple solution and it works good. You got rep from me. I answered to this so late because I did some testing.

    I don't understand why you said to move the analytics script in the head. I left it before </body> and it works.
     
    pubsit1000, Oct 7, 2007 IP
  7. mac

    mac Peon

    Messages:
    76
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    My pleasure, glad it worked out for you!
     
    mac, Oct 7, 2007 IP