How to track distinct pageviews on ASP.NET postbac

2019-09-17 04:24发布

问题:

The typical situation I'm dealing with is an ASP.NET form page (generally an opt-in or sign-up form) that posts back to itself when the user hits submit. By default, Google Analytics will track both of these views as the same page, so it's not possible to detect which visits are the initial view vs. which are the "success" view.

In the past, I've dealt with this in one of two ways:

  1. Using Event Tracking to track form submission as an event. This works fine, but in GA you don't see this metric in the same place as you see the initial page views.
  2. Dynamically adding a querystring to the form's action attribute so the resulting pageview actually shows up as a different page in GA. This feels like a hack, but I like the way the data shows up in GA.

Is either of these approaches preferable, or is there a better way to do it that I haven't thought of?

回答1:

Have a look at virtual pageviews, using them you can make GA think of any event like it was a pageview with the URL you specify.