Adding Vanity URLs in DNN page settings are not being tracked in Google Analytics (GA), these URLs should be tracked to make the analytical data consistent.
The default method for adding vanity URLs/redirections into DNN via Page Settings does not track the URL visit in Google Analytics.
For example, if a user visits https://website.com/vanity-url, the response is a 301 (redirection) to https://website.com/full-page-name. Since the DOM for /vanity-URL is not loaded, the Google Analytics script is never triggered for this request.
On the other hand, the Page View event is fired for /full-page-name since the page and script are loaded. The result for this example, therefore, is that visits to the vanity-URL are not tracked. In contrast, visits to full-page-name are artificially inflated.
There are two solutions available to resolve this issue:
Using a Campaign URL (Recommended method)
One solution is to use Campaign URLs to track the number of times those VanityURLs were used. Google also recommends this option when using redirections.
The following process details the steps needed to add a Campaign URL for an Evoq 7 instance.
Visit Google's Campaign URL Builder site and create a campaign URL for one of the pages. In this example, we are creating the page /myvanityurl1, which redirects to /AboutUs for the web site http://auto.content700.com.
Go to the DNN site, and create a new page with the name/URL. In our example, the page is auto.content700.com/myvanityurl1.
In the Advanced Settings for this page, add the redirect using the link created in the URL builder.
Visit the vanity URL (/myvanityurl1), which should redirect to /AboutUs?
Open the Google Analytics Console and select Traffic Sources under the Realtime Reports menu to confirm that the Source for this page visit is being tracked.
Finally, we recommend upgrading to a newer version of DNN/Evoq, since they provide an option to create multiple vanity URLs without the need to create a new page each time.
Modifying the Vanity URL Implementation
Optionally, to track the Page Views for those vanity URLs, you need to change the implementation in a way that the vanity URL page does not redirect right away.
You can add a custom script that redirects after the GA script event is fired.
By adding this script, the vanity URL page loads and fires the Google Analytics Page View, then redirects to the correct page.
Please note that this implementation increases the time it takes to redirect to the new page since the page needs to load partially. Nevertheless, this fix would guarantee that a Page View is triggered for the Vanity URL.