Discover how to set up and trigger custom goals in Umbraco Engage using C# code.
To set custom goals:
Navigate to Settings > Goals in the Umbraco Engage section.
Set the goal type to Custom.
Execute C# code to trigger the goal.
Creating the goal is similar to creating a page view or page event goal. The goal ID displayed in the code snippet after saving, as it's needed to trigger the goal from the code.
To trigger the goal, execute C# code during the visitor's pageview. Inject Umbraco.Engage.Business.Analytics.Goals.IGoalService
, which has a TriggerGoal(long goalId, int value)
method. An implementation looks like:
The method automatically determines the current page view, linking the goal to a session and visitor. This means the HttpContext should be available.
To trigger a goal outside of an HTTP request, use the overload of TriggerGoal that takes the GUID of the pageview.
Retrieve the pageview GUID in the original request using Umbraco.Engage.Business.Analytics.Common.IPageviewGuidManager. You will need to store this pageview GUID for later use when invoking:
This custom goal can now be used like other goals and will show up in any statistics related to goals.
When setting up Umbraco Engage on your Umbraco project it is important to get the configuration right. Learn more about the different options in this section.
In this section, you can find information about configuring different parts of Umbraco Engage.
Users can set goals to track important actions or A/B test results. These goals help monitor performance and effectiveness.
You can also find an article on setting up custom Goal Scoring.
While most configurations and settings will be visible in the Umbraco backoffice, they can only be changed in the appSettings.json
configuration file. The configuration file article provides an overview of the available settings.
Administrators can assign different permissions to control access to marketing and content apps, based on user roles or Document Types.
These settings allow users to manage and fine-tune their marketing efforts, ensuring data accuracy and access control.
Get an overview of the configurations options in Umbraco Engage.
Most of the Umbraco Engage configuration options are stored in the configuration file. Umbraco Engage uses the standard for .NET Core applications, in which we make use of the appsettings.json
(and environment variable support). Because of this new standard, most configuration options no longer require the application to restart to take effect. This comes with a few exceptions.
Umbraco Engage ships with an appsettings-schema.json
file, allowing Visual Studio or Jetbrains Rider to auto-complete the configuration options. It comes with information about default values and a description of what each configuration option does. Do not change the -schema.json files!
The default configuration will look like this:
All these settings are also visualized in Umbraco Engage. This overview can be found in the section Engage -> Settings -> Configuration.
You cannot change any of the settings in the backoffice. To use the new settings the website must be restarted.