views:

1154

answers:

5

I have a web page in which people go to register for my site. I use server side validation to authenticate them. I need to call some Javascript to tell GA that user was or was not registered. Later I need stats on success in registration.

How can I call the GA function on my server side C# code?

A: 

I don't think Google Analytics is set up to do what you are trying to do. You should just be pasting the code into your master page. From there, you should be able to get a good idea of how many people have registered based on how many visited the landing page after they register.

Geoffrey Chetwood
A: 

Paste the code Google gives you into your footer or template that is displayed on every page or each of the individual templates if you don't have a footer.

Then you can setup "conversion goals" on the pages where users end up when they are successful or not successful.

If you just want to track how many, it would probably be easier to just store it in your own database.

BTW, Google Analytics doesn't work like you are thinking. It's all based on hits to pages and/or get/post parameters

Darryl Hein
A: 

I don't know about Google Analytics, but I have used "beacons"

The info on this URL looks promising http://code.google.com/apis/analytics/docs/gaJSApiEcommerce.html

Greg Ogle
+1  A: 

Rich B is correct, google analytics is triggered by client-side javascript. I saw the comment about Flash demonstrations, but bear in mind that Flash executes on the client.

see flash example

you will need to emit some javascript to the client on a successful registration that simulates the goal page (like in the flash example)

Steven A. Lowe
A: 

A project i have released under open source allows for easy integration with Google Analytics from .net native code to fire page views, events etc through code.

It's called GaDotNet and can be found here: http://www.diaryofaninja.com/projects/details/ga-dot-net

Doug