Reuse custom event goals
Solved! Go to Solution.
Thanks for reaching out!
Could you expand a bit more on what you are looking to achieve?
where eventName is the custom event name you are looking to fire.
Please let me know if you were looking to do something different and if there is anything else I can do to help.
I have a couple of custom event goals that need to be triggered in jQuery .ajaxComplete() event function with some more if.else checks. And these (around 30) code lines does not need to change for different experiments.
So, when I see these goals listed in "Use Saved Goals" option in editor/home's "Add Goals" panel, it looks like I can actually Reuse those Custom Goals. That's why I am curious about how this can be achieved instead of copy/paste them again. Does this make sense
If there is no such option, there can be a note displaying "Do not forget to use any previous code or these ('window.optimizely.push(["trackEvent", "eventName"]);') sort of code lines."
Please let me know if the explanation still look confusing.
As you mentioned, goals can be used throughout multiple experiments. This is why you see the "Use Saved Goal" feature. You do not need to copy and paste them again.
As far as the custom event calls, you will still need to make the call when your users trigger the goal. Optimizely will know what experiment to attach them to based on the experiment that your user has been bucketed into.
Does that answer your concerns?
Let me know if there is anything else that I can do to help,
Alternatively, ask your developers to add it to whatever JS file is common to every page of your site.
(You will still need to add the goal to the experiment, but you won't have to worry about the goals tracking)
Analytics and Testing Guru