Dynamic Announcement Banner in Server Environment (migrating to cloud)

We are migrating to cloud this weekend and have many external links pointing to our legacy instance. Therefore we were looking to add a global announcement banner that provides a url to the cloud instance search results page and utilizes the page name and/or space key as the search string. Does anyone know how we can access these form variables from within the announcement banner page? I know we can do something similar to this by defining a space level by creating a decorator in the page layout.