I have a DXA 2.2 web app set up along with the XO module. Promotions created in the "CME targeting section" are working fine when I am using OOTB trigger types (like browser type etc.).
Now I am trying to create a custom trigger type, a very simple boolean based trigger type. I was thinking that it may be possible to write custom trigger types without writing any cartridge. With that understanding I wrote some code in httpmodule and code is pretty simple and looks like:
Uri uri = new Uri("taf:claim:demo:showpromotion");
if (!AmbientDataContext.CurrentClaimStore.Contains(uri))
{
AmbientDataContext.CurrentClaimStore.Put(uri, true, ClaimValueScope.Session);
}
This code is adding a claim to the claim store. I configured samrttergetconf and ambiend_data_conf in the application along with microservices (Session enabled content service) so that this claim is forwarded. Corresponding files form my web app are shown below:
But in the smart target Model builder, in its ExecuteSmartTargetQuery method, my custom trigger is not returned from the AmbientDataHelper.GetTriggers(ClaimStore) method call.
I have not written any cartridge and I am trying to set the claims from my dotnet application only. So my questions are:
- Is it possible to use custom triggers without writing any cartridge for them? or writing a cartridge is mandatory?
- If it should work without a cartridge, then what am I missing, and why my custom trigger is not returned from the AmbientDataHelper.GetTriggers method call?