- Premium Data
- Getting Started
- 51Degrees.php Config
- Using the Detector
- Advanced Usage
- Accessing Metadata
- Image Optimiser
- Client Side Overrides
- Passing Properties To Client Side
- User Performance Monitoring
- Usage Sharing
- Automatic Data Updates
- Advanced Suggestions
The 51Degrees Device Detector can be used to control whether a particular kind of device will use a certain Drupal theme or if it will redirect to a different URL. The plugin can have multiple rules set up at once so a different theme can be setup for mobiles, tablets, input methods or any other data provided by the 51Degrees Detector.
After installing the 51Degrees Device Detection Drupal plugin, open the plugin menu by clicking the 51Degrees link from the admin area. Configuration -> SYSTEM -> 51Degrees.
You will see the following screen:
Start by creating your first rule by pressing the 'Add New Rule' button. This will refresh the page showing a screen with a single tab. Each tab represents a single rule, each with options to specify detection conditions and their output.
Let's create a rule that will switch to the "Bartik" theme for all mobile devices:
- Check the 'Mobile' mobile checkbox in basic properties. Additional basic properties from the yellow box can be enabled by using our Premium device data .
- Advanced properties can be used to go into more detail about what devices should be switched, such as the manufacturer or input methods. We don't need to complete this for now so we can ignore it.
- Finally, set which action should be taken. The drop down list has all currently listed themes and an extra option for specifying if a different URL should be used. Select the "Bartik" theme and press the 'Save Rule' button.
- You should now be able to visit the site from a mobile device or mobile emulator to see your site responding to the device with the "Bartik" theme. We used "Bartik" as an example, a site may use any number of device optmised themes to ensure a great mobile web user experience.
An unlimited amount of rules can be created, allowing for different device and property combinations to be redirected to different themes or sites.
You can create new rules by pressing the 'Add New Rule' button. A new tab will be added and will be given a unique name. The rule name can be changed by overwriting the textbox in the tab and pressing 'Save Rule'.
The positioning of the tabs affect their priority. The Rule that was encountered first (ie, the left most tab) will be used if two Rules clash over a device. You should have your most specific Rules on the left going to least specific Rule on the right.
The order of the tabs can be changed using the 'Shift Left' and 'Shift Right' buttons on the selected tab. These options are only available when the tab is allowed to move in that particular direction.
If no matches are found the default theme and requesting URL are used.
Properties in the 'Basic Properties' section are chosen because they are frequently used and are helpful for developers. We keep them in one place, to allow for ease of use. Also, unlike the 'Advanced Properties' section they are evaluated on an "OR" basis.
Any device that was true for at least one of the following properties would satisfy that Rule:
This allows developers to quickly make Rules that cover a lot of devices, rather than having multiple Rules with the same action.
However, if more detail is required then the Advanced Properties can be used. These properties are evaluated on an "AND" basis. First, they must be enabled via the checkbox, then their desired value set in the drop down box. By having the separate enabling step a Rule can check if the property should be false.
Advanced Properties can be expanded by clicking 'show'. This will show a list of advanced properties available. A property must be enabled with the checkbox, and then the desired value picked from the list.
In this example devices made by HTC will be caught by this rule. HardwareName and Has3DCamera will not be considered as they have not been enabled.