We have a question about Triggers on SmartTarget. One of our customers has a particular need. They need to use a trigger that uses the value of a field entered by the user in the condition. We do not know what it's called because it can be variable. Is there a possibility to implement this type of triggers?
-
1I'm a little confused about the details here. Are you saying they want to show a Promotion that matches whatever a visitor types in a field on the website? What would it match on? If it's free text, they could literally enter anything at all -- so what's the plan for finding matching content?– Peter KjaerJan 23, 2017 at 15:52
-
The content that is managed in Tridion in this case, is based on schemas, for example, we have a TextBox scheme. The editor can create a component of this TextBox scheme, for example, Profession. When a user accesses our page, he can enter the value of this field, farmer. We have created a promotion associated with this field. The trigger is called Profession. If the profession is a farmer we put a link associated with farmers. The problem is that the user can change, even create new components ith schema TextBox. We would like to be able to create promotions associated with these components– eredondoJan 25, 2017 at 7:55
1 Answer
You can create a trigger that has free text values, this means that it can accept any user input from a text field. This however raises the question: How do you want to use it to build Promotions? You could in theory create a filter to match the trigger value to a schema field value so only content with that value in a certain field is shown. It's hard to understand exactly what you want without more specific example of your requirements.
From your comment "We have developed a form generator, something akin to Tridion Webforms. We want to use the values in the fields of these forms to create promotions. And we can not know the field name to define the trigger" - it sounds like editors should be able to create triggers 'on the fly' by specifying that certain fields in forms they create with the CMS can also be used as triggers. Creating triggers can be done programatically via the SmartTarget CD API (see http://www.tridiondeveloper.com/create-fredhopper-trigger-types-programatically) so you could, in theory create a small service to generate them on the fly and hook that into the deployer or template code. I would be careful though - giving editors the ability to create triggers might mean that you end up with an unusable and confusing system after a few months, with hundreds of one-off triggers for throw-away forms.
Its difficult to know if it might suffice, but you could just have a single generic form field trigger, and use a convention for the values, where you prefix them with the field name (so if your editor creates a "country" field, and the visitor selects "es" when filling in the form, the trigger value could be "country|es"). Its not very editor friendly for creating the promotions, but would avoid creating a mess of too many triggers.
-
We have developed a form generator, something akin to Tridion Webforms. We want to use the values in the fields of these forms to create promotions. And we can not know the field name to define the trigger.– eredondoJan 24, 2017 at 7:59
-
We were thinking about this last option. But we are not clear where to save the value that the user has entered when submitting the form, to be able to validate if the condition has been fulfilled for triggering the trigger. Other times we were saving it in the FAS. On the other hand I'm not clear when creating Fredhopper Trigger Types Programatically. Once created, are they available to be used?– eredondoJan 24, 2017 at 11:30
-
Once a trigger type is created you need to flush any trigger caches. FH has one which can be flushed with a URL and the ADF has another which currently can only be flushed by application reset Jan 24, 2017 at 13:15
-
For the generic trigger you just need an ADF cartridge to process form data submitted and add claims to the ADf Jan 24, 2017 at 13:16