I have a olddomain.com that redirects to newdomain.com and we want to know the best way to track how many people are coming from olddomain.com on Google Analytics?
Currently I have two rewrite rules which basically just redirects olddomain.com to newdomain.com like below. What I want to accomplish is to be able to somehow log into Google Analytics and track how many times visitors came from olddomain.com. I have seen this article but its for Apache server using .htaccess. I would like to know how to do this with IIS 7 using rewrite rules or redirects so GA can track these also.
<rule name="Force HTTPS and use production domain - olddomain.com" stopProcessing="false">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^m\.olddomain\.com$" />
<add input="{HTTP_HOST}" pattern="^olddomain\.com$" />
<add input="{HTTP_HOST}" pattern="^ww2\.olddomain\.com$" />
<add input="{HTTP_HOST}" pattern="^www\.olddomain\.com$" />
</conditions>
<action type="Redirect" url="https://www.newdomain.com{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
</rule>
<rule name="Force HTTPS and use production domain - olddomain.com" stopProcessing="false">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^m\.olddomain\.com$" />
<add input="{HTTP_HOST}" pattern="^olddomain\.com$" />
<add input="{HTTP_HOST}" pattern="^ww2\.olddomain\.com$" />
<add input="{HTTP_HOST}" pattern="^www\.olddomain\.com$" />
</conditions>
<action type="Redirect" url="https://www.newdomain.com{REQUEST_URI}" appendQueryString="false" redirectType="Permanent" />
</rule>
url="https://www.newdomain.com{REQUEST_URI}?utm_campaign=domainnames&utm_medium=domain&utm_source=olddomain.com"
https://www.newdomain.com{REQUEST_URI}?utm_campaign=domainnames&utm_medium=domain&utm_source=olddomain.com
and it logged into Google. I think I need to somehow redirect and then rewrite the URL.