Traffic Routing 2: Route by referer, user agent, or language
Besides routing based on IP address and country lookups using the CR country routing rule, it's possible to route traffic in other ways using Addue. Addue provides 3 other rule types for this purpose. Here they are with their 2 letter Addue codes:
LA - Language Routing Rule - Route traffic according to user language field
RF - Referer Routing Rule - Route traffic according to referer field
UA - User Agent Routing Rule - Route traffic according to user agent field
These three rules work similarly. They look at information passed along by the visitor's web browser and use that to make a decision on where to route it.
The referer routing rule works based on the referer set by the visitor's web browser. When traffic to your website comes in from another websites, the visitor's web browser often (but not always) passes along the URL of the website that referred it. This information can be accessed and used to make a determination on where to send the traffic. It is not however always available - sometimes the visitor's web browser will leave it blank. So it can't always be relied upon. It is important to always use a DR default routing rule in conjunction with RF referer routing rules to tell Addue what to do with traffic that doesn't fall under any of the RF rules available.
Let's walk through an example using the RF rule type before talking about the LA and UA rule types.
Insert a new rule selecting the RF rule type. Set up the rule as in the form below:
Give the rule ruleset ID "tutorial3" as in the form. The destination URL is where the traffic will be sent if the conditions of the rule are met. We'll set that to a landing page on our favorite fake domain, http://jollyniceflowers.com/page1.
The Search String field is what defines the rule. This is the phrase that Addue will look for in the referer URL passed along by the visitor's web browser. As you can see we've set this to "facebook.com". If Addue.com detects this phrase in the referer URL, it will send the visitor's click to http://jollyniceflowers.com/page1.
Search string matches are always case-insensitive. It doesn't matter whether you enter Facebook.com or facebook.com - either would match a referer containing facebook.com, or a referer set to Facebook.com.
Put in a couple more RF rules in this tutorial3 ruleset. Enter a similar rule with destination URL http://jollyniceflowers.com/page2 and search string "twitter.com" and another with destination URL http://jollyniceflowers.com/page3 and search string "google.com".
Finally put in a default rule (DR type) with the same ruleset ID ("tutorial3") to send all other traffic to destination URL http://jollyniceflowers.com.
When you look at your ruleset in under the List/Edit/Delete rules section, you should now have something like the following:
The rule has now been set up as desired. When traffic comes in, Addue will look at the referer data. If it sees "facebook.com" in the referer data, it will send the traffic to http://jollyniceflowers.com/page1. If it sees "twitter.com", it will send it to http://jollyniceflowers.com/page2 and http://jollyniceflowers.com/page3 if it sees "google.com". All other traffic will be sent to http://jollyniceflowers.com by the DR default routing rule.
To invoke this rule, use the Addue link provided in the ruleset listing page:
If you click that link, you'll see that Addue figured out the click wasn't coming from facebook.com, twitter.com, or google.com and correctly used the DR rule to route it, sending it to http://jollyniceflowers.com
The UA user agent rule and LA user agent rule work similarly to the RF rule. They look at the user agent data and browser language data respectively instead of the referer data.
The user agent data is a string similar to this one that browsers usually pass along:
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0
This contains information about the kind of web browser (Firefox in this example) that is being used. If you use this rule type and set up a rule with "Firefox" in the search string, all visitors that have Firefox identified in the search string will be routed to the destination URL specified in your rule. As with the RF rule type (and the LA rule type), UA rule types do not consider case when matching search strings to browser data. "firefox" would also match the example given.
The LA rule type looks at the language field passed along by the browser (technically known as the Accept-Language header) to see if the search string specified matches any part of it. The language field is something like the following example:
The first part of this header specifies that the preferred browser language is US english - en stands for English and US stands for the United States domain. You could set up a search string as "en-US" to look for this in the language header
Feel free to experiment with the UA and LA rule types by setting up some rules using either.
You can actually mix CR, UA, LA, and RF rules in the same ruleset. Addue will go through all the rules you have available to try to find a rule it can use to route the traffic. The order in which it applies the rules is CR - RF - LA - UA. In other words, it will first try to find a CR rule which applies, then look at any RF rules present, then LA, then UA rules. One way you could use this feature for example is to route traffic by country using CR rules, falling back to LA browser language rules to try to route based on browser language if the CR rules couldn't identify the country for any reason.
You should always include a DR default routing rule with rulesets containing CR, UA, LA, or RF rules. If none of the rules you provide match the incoming traffic, the DR rule's destination URL is where Addue will send it.
And that wraps it up for this tutorial; as always if you have any questions please feel free to drop us a line.
Share This Article: