If the study utils web extension experiment API is undefined, it is probably disabled for security reasons. In branded versions of Firefox release and beta, add-ons with webextension experiments needs to be signed. In devedition and nightly, the extensions.legacy.enabled configuration needs to be set to true. If the experiments API is disabled, the following error is reported currently: TypeError: browser.study is undefined; can't access its "onEndStudy" property.
The template could check if browser.study is defined and if not, inform about relevant actions in the browser console.