When content preloading is enabled for a modification, flickering is decreased when displaying large content items, such as banners. However, content preloading has some limitations. For example, you can't define a modification to be displayed on specific hours of the day or specific days of the week. You can work around this limitation by binding a trigger to a placement that you then associate with a modification.
This example uses simple custom JavaScript for getting the time of the day as a rule for the trigger. The trigger is defined so that the modification is only displayed to visitors during the evening hours (18:00 to midnight). This is useful when you want to target audiences that typically make their purchasing decisions after office hours.
You must first create a trigger to detect the time of the day, and then create a placement for using the trigger to display the modification.
To create the trigger:
Define the following settings:
Rules: Click Add new rule, select JavaScript code, and set the following rule:
The value of the
JavaScript function is exactly true. This means that when all HTML elements have been loaded on the page, the JavaScript functions checks whether the current time is between 18:00 and midnight. If so, the function returns "true", and the trigger is fired. |
To create the placement:
Define the following settings:
To use the trigger in a modification:
The modification is now only displayed to visitors during the evening hours (18:00 to midnight).
You're done with this example!