Forum Moderators: open

Message Too Old, No Replies

add URL data to hidden form fields

using JS to monitor keword performance

         

ssling

4:49 am on Aug 23, 2006 (gmt 0)

10+ Year Member



does anybody know how to use javascript to read the keywords off a url and enter them as a hidden field in a form?

i use javascript for form validation etc... but would also like to pull in the ppc keywords into the form as well so when a user submits a form, the keyword and search engine will also appear.

thanks!

RonPK

8:45 pm on Aug 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello ssling, just to help me understand: are you talking about analyzing the referrer?

ssling

6:30 am on Aug 24, 2006 (gmt 0)

10+ Year Member



hi RonPK, thanks for responding.

basically, the problem is i cannot get any analytics programs to work for me... urchin/log analysis/thank you page cookies/blah blah... none of them give me a simple answer to the following question:

who referred the customer to me (i.e. search engine) and what keyword did they search?

"conversion" on my site is very simple: a customer fills in a form and clicks submit. i then have a cgi script process the form and send me an email with all the fields they filled in. i want to also include in that email the referrer and keyword that got them there.

can you do this with javascript?

thanks!

RonPK

7:48 am on Aug 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK. It's quite easy to insert the referrer into a hidden field and send it to the server along with the other fields in your form.

<form name="aform" action=...> 
<input ...>
<input type="hidden" name="referrer" value="">
<input ...>
</form>
<script>
document.aform.referrer.value=escape(document.referrer);
<script>

The other thing is to parse the referrer and to detect any search keywords. I recommend to do that on the server. Search engine query strings come in many varieties and your visitors would have to download a large piece of javascript to cover the major options.

jetboy

7:55 am on Aug 24, 2006 (gmt 0)

10+ Year Member



When you mention Urchin, are you talking about Urchin 5, the log analysis version?

ssling

9:22 am on Aug 25, 2006 (gmt 0)

10+ Year Member



hi jetboy,

no, i was just referring to the analytics that comes with the google adwords account... is that other one any good?

RonPK,

cool, thanks!

regarding parsing the query string, is there any way you could get javascript to just write the whole damn query string url to the form? i would happily "parse" it myself visually when i get the email as it is very low volume...

jetboy

9:37 am on Aug 25, 2006 (gmt 0)

10+ Year Member



It is, but unless Google keep it in development it's hard to recommend.

I only mentioned it because it supports regex filters to do things like map referrers or tracking parameters onto the pages report, so pages with different referrers or parameters are considered to be separate pages.

Add your order ID as a parameter when you call the form confirmation page, and perform a similar mapping to above, and each order confirmation is treated as a separate page.

You can then use the Urchin report that shows path through the site to show which keywords and referrers resulted in which orders without resorting to JavaScipt.

Arno_Adams

10:13 am on Aug 25, 2006 (gmt 0)

10+ Year Member



Hi ssling,

to get the querystring in javascript:
location.search.substring(1)

add that value to a hidden formfield.

HTH, AA

daveVk

1:28 pm on Aug 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



is there any way you could get javascript to just write the whole damn query string url to the form?

Yes as per RonPK reply above

ssling

4:46 pm on Aug 25, 2006 (gmt 0)

10+ Year Member



cool!

i just added the code and got a form submitted about ten minutes ago with the full search string... finally! exactly what i wanted...

thanks guys.

jetboy, i'm going to loook into that...