Domains¶
A domain is used to identify a certain domain or group of domains. With a domain you can dynamically enrich your data and trigger tool configuration. Domains are required for Harvest to work.
A domain works based on the matching domain. This matching domain can either specific to match only one domain and it’s subdomain and protocol or can be broad and match all protocols and subdomains.
A domain consists of the following parts:
Part | Example |
---|---|
Protocol | http |
Domain | graindataconsultants.com |
Subdomain | www |
What is a matching domain?
By default, a matching domain is specific per protocol and subdomain. That means that if you want to track:
- http://www.graindataconsultants.com
- https://www.graindataconsultants.com
- https://demo.graindataconsultants.com
That you will need 3 matching domains. This has benefits, but can also become tedious. To overcome this problem, it is also possible to make use of a “catch-all” option for the protocol and the subdomain.
Catch all protocol
Let’s say you want your matching domain to match any protocol, you could then use an *.
- *//www.graindataconsultants.com
The above matching domain will match both:
but it does not match:
Let’s say you want to match all sub domains as well. Then you can use the subdomain catch-all:
//.graindataconsultants.com
The above matching domain will match all protocols and all subdomains.
Sub sub domains
Harvest can only handle subdomains. If you have sub sub domains or go even deeper, it is not possible to make a distinction between them with domains. All sub sub domains will be seen on sub domain level.
Why is the matching domain relevant?¶
The matching domain seems complicated, but it has some important functions.
Tool configuration matching
One important aspect of online data is using it in several tools. Many tools work in a way that you will have a different account per domain.
For example, when using Google Analytics, you might have a different UA-code per domain. When using a tag management system this would mean you would use different tags or using complex code to define when you should use which UA-code.
Harvest makes this easy for you. With an easy to use user interface, you can easily match your domains to specific tool configuration (in the case of Google Analytics this would mean a specific UA-code).
IMAGE REPLACEMENT: TOOL CONFIGURATION MAPPER
An example of how you might use this can be seen in the image above. It might also be the case that you do not want to have a different configuration for each domain. In this case you might want to use the catch-all option.
Another option is to use the regex option of subdomains to make groups of subdomains which you want to handle similarly.
Variable enrichment
Besides using domains to easily control the distribution of data. You can also using domains to enrich your datalayer. This way you will make it easier for your developer to do an implementation, but it also gives you much more flexibility.
Let’s say we have the following subdomains:
- https://www.graindataconsultants.com (Production)
- https://staging.graindataconsultants.com (Staging)
- https://test.graindataconsultants.com (Test)
We already have defined the above domains as matching domains, because we use a different Google Analytics UA-code for each domain. Besides that we would like to add the environment an event occurede on (production, staging, test). we can solve this in two ways:
- Add environment in the datalayer
For more information about our tracking code, read the tracking code documentation.
In this option, the developer needs to add the information.
- Add a variable link
IMAGE REPLACEMENT: EXAMPLE VARIABLE LINK
In this case you will tell Harvest you want to have the value of production to be assigned to the variable pageData.environment whenever this specific domain is matched.
This gives you a lot of flexibility.
Note before you can use the environment variable in pageData, you will need to add the variable. For more information read the variables documentation.
Conflicting matching domains¶
You can imagine that you will create multiple matching domains that match the same domain. For example, if you have the following matching domains:
https://graindataconsultants.com *//graindataconsultants.com
Both of these will match:
https://www.graindataconsultants.com
When this happens, Harvest will use the following priority:
- First Harvest checks for exact matches
- Then Harvest checks based on catch-all
For each step Harvest will move from the first configured domain to the last. The first match will be used.