Triggering a Goal from a Goal in Sitecore
In Sitecore all goals are technically page events. This can cause issues if you need to trigger a second goal via the rules on the original goal. Take the following example.
A clicks the contact us button on the homepage. If the user has been to the site many times previously (say 10 times) we want to also fire a "engaged user conversion" goal.
The main issue that comes up when trying to make this happen is a bit of circular logic inside of Sitecore. When the rules engine triggers a goal the following sequence of events occur.
- The original goal on the page is triggered. It's typically added by a marketer.
- The rules on the original goal check if the current user has visited the site 10 times. If so, run the Trigger Goal Action.
- The action registers the new goal "engaged user conversion" on the page.
- Sitecore runs the rules engine again which brings us back to step 2. Repeat.
To get around this you need to check the current tracker to see if the goal for the user has been triggered yet before triggering it again. This will break the loop prevent the stack overflow.