Incorporating different existing analytic solutions into a new script

Hey, I want to build a script that acts on attributes of the visitors. The client might be searching for my site that has the script installed, and when they enter my site, the script runs and is able to collect information based off of where they came, which then will show them different versions of the script based upon what keyword they were searching for, what refferal they came from(Eg, email, or different site.) etc.

For example:Customer is looking for adidas shoes- They enter my site from Google with the keyword of Adidas Lowtops, the script would run and show them specifically low tops and adidas shoes. This can be done by referral, Geo-location, etc. I know I can write a separate function that captures each individual attribute; but I was thinking that I can interface with some analytic solution that does this already.

Eg- Google Analytics will tell my script that the visitor came from searching a specific keyword.

any thoughts?

No replies? :frowning:

Perhaps if I re-word the question-

I’m building a script that will recommend products based upon questions the script will ask the visitor. However, I’m looking to track certain attributes before the client reaches the script.
Attributes such as:
What referring site they came from.
What keywords they were using.
etc.

Now, we understand we can create this analytic program ourselves, however our question is- Is there any API already out there that we can integrate? Google Analytics?

Any thoughts would be appreciated.