5

We recently implemented IIS7 URL rewriting on our site to have nicer looking URLs.

However, the day we implemented it, in Google Analytics, our paid versus organic search results got completely screwed up. Suddenly it is counting paid click-throughs (AdWords) as organic. It shows correctly in AdWords (~200+ click thrus paid per day) but only maybe ~10 paid show in Analytics, but our organic accounts for the missing paid click-throughs.

I was wondering if something in my URL rewriting was preventing Analytics from tracking the paid AdWords click-throughs?

Here's a sample of the link shown for our ad on Google:

http://www.google.com/aclk?sa=l&ai=C03Wve-ZTTt7QC-i8sQK5iIGXA-7_wYMCvpDoqxu54dM0CAAQASgDUMGQrLb7_____wFgydaQjNCklBCgAcfhhv8DyAEBqgQbT9Daa567OsJBGZL_14L3WbAhEpxL9j8g6o7&sig=AOD64_0JL2LlkX_ZN_YDHqOFFlAhTrIb7A&ved=0CAgQ0Qw&adurl=http://www.ourdomain.com

The ad, as you can see, points to http://www.ourdomain.com (example) - the root directory. This goes to Default.aspx which has a redirect in the code behind page load event that redirects to Home.aspx (http://www.ourdomain.com/home.aspx) -- No URL rewriting taking place. This particular redirect has been in place since well BEFORE URL rewriting was implemented and was tracking referrals fine UNTIL I added IIS 7 URL rewriting.

I only have 2 rewrite rules that I can possibly think of that might effect the Google AdWords link (see below).

<!-- Remove any trailing slashes -->
<rule name="Remove trailing slash" stopProcessing="true">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}" />
</rule>

<!-- Homepage Rewrite -->
<rule name="Homepage">
<match url="^Home$" />
<action type="Rewrite" url="/home.aspx" />
</rule>

I don't see why either of these would cause problems because again, the URL for our AdWords ads points to the root directory - http://www.ourdomain.com (no trailing slash and no /home).

Any other ideas of what I might check? Thanks so much!

Paul Tyng
  • 7,924
  • 1
  • 33
  • 57
amglori
  • 175
  • 1
  • 9
  • It's very hard to say for sure without seeing all rewrite rules. I can only suggest adding `appendQueryString="true"` in ``). Every AdWords link when clicked will have some extra parameter in query string (`gclid`) which may be essential for Google Analytics to work correctly. I'm having that parameter present everywhere and so far I have no issues with differentiating traffic source. – LazyOne Aug 24 '11 at 13:24
  • Is it intentional that the second rule is a rewrite not a redirect? This will make your requests `http://www.ourdomain.com/Home` not `http://www.ourdomain.com/Home.aspx` (although I guess you have no links to that). – TheCodeKing Sep 03 '11 at 01:49

1 Answers1

3

First of, no redirect or rewrite rules in the web.config file will work unless the IIS URL Rewrite module has been installed.

For analytics to work, the link would in special query string parameters, so you need to ensure that your rule has appendQueryString="true" on the action node.

And @TheCodeKing states that you are redirecting example.com/Home and not root page; you should check your analytics code for hits to '/Home' and not '/', your AdWords reports will only be looking for hits to '/' only.

simbolo
  • 7,279
  • 6
  • 56
  • 96