AFL UTM Tracker Documentation

  1. Home
  2. Docs
  3. AFL UTM Tracker Documentation
  4. Misc / Issues
  5. WWW and Non-WWW Domain Issue

WWW and Non-WWW Domain Issue

If the First Touch UTM report is empty even though you have tested it with a UTM URL, there’s a possibility that your WordPress site is configured with a different subdomain that the UTM URL which you have tested.

Scenario 1

  • WordPress Site URL is configured on the non-WWW domain (https://example.com)
  • Visitor visits on the WWW domain (https://www.example.com)

Scenario 2

  • WordPress Site URL is configured on the WWW domain (https://www.example.com)
  • Visitor visits on the non-WWW domain (https://example.com)

Problem

Due to difference in the subdomain name, JavaScript (JS) files are unable to communicate to your WordPress server through AJAX. This is a browser security feature under Cross-Origin Resource Sharing (CORS) to prevent malicious scripts from sending personal data to a different domain.

In addition, for security benefits our plugin will secure the cookie through the Domain attribute setting. This will prevent any other domain than the one configured in WordPress to read the cookie value.

Solution

Therefore in a correct server setup, you would need to setup your server such that a URL redirection is initiated when the visitor browses to your website using a URL not as configured in WordPress.

Scenario 1

  1. WordPress Site URL is configured on the non-WWW domain (https://example.com/page/?utm_source=google)
  2. Visitor visits on the WWW domain (https://www.example.com/page/?utm_source=google)
  3. Visitor is redirected to the non-WWW domain including the full path and query parameters (https://example.com/page/?utm_source=google)

Scenario 2

  1. WordPress Site URL is configured on the WWW domain (https://www.example.com/page/?utm_source=google)
  2. Visitor visits on the non-WWW domain (https://example.com/page/?utm_source=google)
  3. Visitor is redirected to the WWW domain including the full path and query parameters (https://www.example.com/page/?utm_source=google)

How to setup URL redirection?

There are many ways where you can setup the URL redirection.

  • For Apache server, you can setup the redirection at the .htaccess file.
  • For Nginx server, you can setup at the Nginx config file.
  • For Cloudflare, you can setup at the Page Rules section.
  • Certain hosting panels has a URL redirection section.

You can Google for the suitable article for your setup but here’s one article which covers 3 setups.