1

Using DNN 9.3.2 and the Advanced URL provider, Google Ads appends a query string with a GCLID. It looks like this: https://example.com/travel-insurance/overview/?gclid=tester-123

When DNN9 gets that URL, it rewrites it to remove the trailing slash between the last word and the ? before the GCLID. It looks like this: https://example.com/travel-insurance/overview?gclid=tester-123

This drops Google Ads tracking. Is there a way to ensure that DNN doesn't drop the / during the rewrite?

twernt
  • 20,271
  • 5
  • 32
  • 41

2 Answers2

2

In DNN 9+, go to Settings / SEO, URL Management, Expressions. Go to "Keep in QueryString Regular Expression"

Add this to the end:

|/gclid/[^/]+

So you are adding a new rule, the first char is the pipe, meaning OR.

Jeremy Farrance
  • 740
  • 6
  • 11
  • 3
    This comment is useful but only a part of the bigger solution. This RegEx prevents DNN from rewriting the query strings from `?gclid=123` to `/gclid/123` but still doesn't solve the issue where DNN drops the trailing slash on querystrings. This answer is the first part of the solution. – Aaron - Wolf X Machina Nov 13 '19 at 21:24
1

You could probably rewrite it earlier using IIS level rewriting. The tricky part will be to find a pattern that still allows you to process the 'hit' the Google Ads link is intended to create.

Since IIS will run FIRST, you might be able to pre-process it such that DNN behaves differently. Once DNN is processing those rules, you've little control unless you're prepared to edit the core code or write a provider.

Alternatively, change the type of ads of nature of links used by them. Though I know that's possibly not an option.