Optimizely Integration: Custom Extensions That Make a Difference

Principal Optimizely & .Net developer, First Line Software

Introduction
Optimizely Digital Experience Platform (DXP) is a powerful enterprise solution that covers most common needs for CMS/Commerce projects, and allows for flexible Optimizely integration with external systems, including a built-in background job scheduler. However, while it is functional, it lacks robustness for complex enterprise-level job orchestration and flexibility.
Hangfire is a modern background job scheduler and a popular .NET solution used across a wide variety of projects. Thousands of companies rely on it, and it is a candidate to be named an industry standard. It unlocks greater reliability, flexibility, scalability, and control over not only scheduled tasks but the whole process pipeline around them.
Main Advantages of Hangfire over Built-in Scheduler
Reliability
Hangfire retries automatically failed jobs according to default settings or custom configuration. It also ensures data execution persistence by storing data using different types of robust storage databases like SQL Server or PostgreSQL. The built-in scheduler doesn’t offer out-of-the-box retry logic, which makes it less resilient and often requires manual intervention by the user.
Flexibility
Hangfire simplifies work for developers as it doesn’t require the creation of custom jobs or tasks by forcing developers to implement interfaces or inherit from base classes. It allows the use of any method or function as an entry point to a job as long as it is serializable. Its API is very straightforward and intuitive, which reduces the time required to develop and maintain jobs. It also provides quick ways to customize or configure the background tasks behavior. Optimizely Scheduler, on the other hand, requires developers to create specific jobs classes, and jobs behavior customization is minimal and not so straightforward.
Scalability and cost efficiency
Hangfire is designed with distributed jobs execution in mind. It allows multiple instances to run tasks as well as having different queues for different sets of tasks that might be used to design a non-monolithic solution for separate services that don’t depend on Optimizely components, which might decrease Optimizely licensing fees. This could be a game changer for huge Optimizely solutions that have a lot of custom logic that is only loosely connected to Optimizely CMS/Commerce. Built-in scheduler operates as a monolith with Optimizely CMS/Commerce, so the only way to have more instances is to have more full Optimizely CMS/Commerce servers.
Control over job execution and monitoring
With Hangfire, both administrators and developers gain fine-grained control over jobs, including:
- Fire and forget jobs – add a job to execute the queue and ensure it will be executed as soon as a free worker is available;
- Delayed jobs – ensure execution at a precise point in time;
- Continuation jobs – enable dependent job execution workflows;
- Recurring jobs – enables job scheduling using full cron expressions and helpers.
On top of that, Hangfire has a built-in monitoring dashboard that provides real-time visibility into job status and execution.

Security
Hangfire integrates easily with authentication and role-based access control. In contrast, Optimizely job scheduler offers only limited security control, making Hangfire a better solution for enterprise tasks.
Future proofing
Hangfire, when adopted into an enterprise solution like Optimizely CMS/Commerce, reduces the maintenance cost of jobs as well as developing new ones. Thanks to its built-in retry policy helps to minimize downtimes caused by failed tasks that can simply be retried. Its distributed architecture also helps ensure easy scalability as needs grow with product adoption by more users.
Hangfire itself can also be extended by multiple NuGet extension packages or custom ones that can be developed in-house for organization-specific needs.
Simple Optimizely Integration with Hangfire: Tech Implementation and Outcomes
It’s one thing to talk about ideas, but it’s another to see them in action. So, this document will walk you through how to integrate Hangfire with Optimizely, proving just how straightforward and useful it can be.
Initially, Hangfire and its console must be installed using the following commands:

As security is critical in enterprise solutions, we will first implement a filter to secure the Hangfire dashboard by incorporating the following class:

To achieve a well-integrated user interface within the Optimizely CMS back office, a straightforward controller is required to embed the Hanfire dashboard into the UI.

In addition, we need to add simple view:

After that, let’s add an entry to the Opti menu, so we won’t have to type URLs manually using the standard Optimizely menu provider:

Lastly, we need to register Hangfire in the startup.cs class, and we will be ready to go. This step completes the Optimizely integration with Hangfire, allowing the platform to fully benefit from distributed job scheduling:


That’s all the work needed to have simple Hangfire integration with Optimizely. We can now enjoy the effects:

More details and all the code shown above are available as text over on my GitHub.
This streamlined approach ensures a powerful and scalable Optimizely integration with Hangfire that meets enterprise-level needs.
Ready to unlock the full potential of your Optimizely platform?
At First Line Software, we specialize in scalable, secure, and high-performance Optimizely integrations tailored to your enterprise needs. Our deep expertise in custom development—like integrating Hangfire for advanced background job management—ensures your digital platform runs smarter, faster, and more cost-effectively.
Contact us today to explore how we can elevate your Optimizely solution.