Documentation » Triggers

Custom Activity

Published · Last updated

Overview

The Custom Activity Trigger in Groundhogg allows developers and third-party integrations to initiate actions in a flow by tracking custom events using the track_activity function. This trigger is primarily designed for advanced users who can implement custom code to log specific activities, which then trigger corresponding actions in a flow.

Custom Activity Trigger

When to Use

Use the Custom Activity Trigger when you need to start a flow based on a specific, custom-defined event that isn’t covered by Groundhogg’s built-in triggers. This is particularly useful for integrations with third-party plugins like WPFusion or when tracking bespoke user interactions that require custom coding.

How It Works

The Custom Activity Trigger listens for events logged via the track_activity function in Groundhogg’s API. When a specified custom event is tracked (e.g., custom_event), the trigger evaluates any defined conditions, such as a value meeting a certain threshold. If the conditions are met, the flow proceeds with the configured actions.

Custom Activity Settings

Setup Instructions

  1. Add the Trigger to a Flow: Drag and drop the Custom Activity Trigger into your flow from the Groundhogg flow builder.
  2. Configure the Event Name: In the trigger settings, specify the custom_event name that will be tracked (e.g., custom_event).
  3. Set Conditions (Optional): Add conditions to filter the trigger, such as value being greater than or equal to a specific number (e.g., 50).
  4. Implement the Code: Use the track_activity function in your custom code or third-party integration. Example:\Groundhogg\track_activity( 1234, 'custom_event', [], ['value' => 50] );
  5. Save the Flow: Click “Save” to activate the trigger in the flow.
  6. Test the Trigger: Execute the custom code to ensure the event is tracked and the flow runs as expected.

Example Use Case

A website using WPFusion wants to trigger a follow-up email sequence when a user completes a specific course module, which is tracked as a custom event. The developer uses the track_activity function to log the event course_module_completed with a value of 100 when the user finishes the module. In Groundhogg, a Custom Activity Trigger is set up in a flow to listen for course_module_completed with a condition that value is greater than or equal to 100. When the event is logged, the flow adds the user to an email sequence, ensuring timely engagement.

FAQs / Troubleshooting

Q: Why isn’t my Custom Activity Trigger firing?
A: Ensure the track_activity function is correctly implemented and the event name matches exactly in both the code and the trigger settings. Check that any conditions (e.g., value >= 50) are met by the tracked data.

Q: Can I use this trigger without coding?
A: Currently, the Custom Activity Trigger requires custom code or a third-party integration like WPFusion to function. It’s not usable out-of-the-box without development.

Q: How can I debug the tracked activity?
A: Use Groundhogg’s activity logs to verify that the custom event is being recorded. You can also test the flow by manually triggering the event with sample data.

Q: Is there a limit to the number of conditions I can set?
A: Groundhogg allows multiple conditions, but for performance, keep them concise and relevant to the event data being tracked.