Setup the Analytics module in continuous delivery
You can use the same configuration for Google Analytics in all your environments, but receive tracking data only form your production site. Using the following settings, the request to other domains are ignored in the tracked data.
NOTE: Because the configuration files, generated by the Analytics module, are from a different provider, they cannot be stored in the database. Therefore, you cannot configure the module after you deploy the site in the cloud. You must do it before the deployment and the files need to be included in the deployment package.
Perform the following:
- Create an account in Google Analytics or use and existing one.
RECOMMENDATION: Google Analytics recommends that you have one account set for every website that you track.
- In your account, create a new property and set the Default URL to be the URL of your production site.
A property represents a website, mobile application, or device. It is the representation of the resource that is associated with your tracking code.
- In this property, create a view and set its Website URL to be that of your production site.
The view is your access point to reports.
- Add a filter for the newly created view.
It will filter the incoming data, so that only data from your production domain will be used.
Perform the following:
- In Google Analytics, navigate to the Admin section.
- Select your Account, Property, and View.
- In the View column, click Filters » ADD FILTER.
- In Filter Name, choose a name for the filter.
- In Filter Type, select Predefined.
- In Select filter type, select Include only.
- In Select source or destination, select traffic to the hostname.
- In Select expression, select that contains or that are equal to, depending on the setup you need.
- In Hostname, enter the address of your production website.
- Click Save.
- Perform procedure Set up the Analytics module.
- In Step 6, in Available accounts dropdown box, select the view that you have created.
- In Step 7, in Tracked domains, select the domain of the production website.
NOTE: If you have not set the tracking code, provided by Google Analytics on any page of your website or the page where you have set it has not been requested, Sitefinity CMS your domain in the list of Tracked domains.
RESULT: Sitefinity CMS Analytics module will display data from your production environment only, regardless of that you are using the same Analytics settings on all of your environments.