If you are active in marketing your website, a common scenario is setting up landing pages. A good landing page exactly matches a visitors expectations. Thus, it’s a good practise to tailor your landing pages exactly to the source of traffic. For example, you may have one landing page which is addressed by a set of slightly different advertisements (i.e. Google AdWords, banner ads, affiliate marketing, etc.). DNN Dynamic Roles is great for customising your content depending on the source of traffic.
Having the DNN Dynamic Roles module installed in your DNN CMS (get it here), and using the following rule when creating a dynamic role, all users coming to your site via Google are placed in a certain DNN role:
The “referer” rule checks the HTTP Request Header “Referer”, which contains the URL of the page your visitor had opened before. Note that the parameter “pattern” is a regular expression (regex). If you haven’t dealt with regex before, it may look a bit scary. There are some good resources on the web where you can learn how to use regular expressions. Have a look at Wikipedia.
However, the referer is not set in many cases (such as having “Do Not Track” (DNT) enabled in your browser).
A better way to deal with traffic sources is using HTTP Request Parameters. Just append a unique parameter to your each of your campaigns linking to your landing page. Assume your landing page is named “lp”. Append a parameter “campaign”, such as “lp?campaign=ad1”. Create a rule in DNN Dynamic Rule like this:
<requestParam name="campaign" pattern="^ad1$"/>
The dynamic role in this use case requires the following settings:
- Eval Trigger=Request and Cache Time=0 (so that the rule is evaluated on each request)
- Update Method=Add (so that the user is not removed from the dynamic role when moving on to another page)
As a result, you can control which parts of your landing page are visible for which roles: Just enable “Edit page” on your landing page, click the gear icon on the module you want to configure, and select “Settings”. On the “Permissions” tab, add and configure the roles you created in DNN Dynamic Roles. That’s it.
As of version 01.02.00, dynamic roles only apply to logged in users. So for these examples to work, your users need to be logged in. We’re going to improve this in a future version to better support scenarios with anonymous requests, i.e. scenarios where the user is not logged in.