Add parameter in url when initializing application

I need a parameter to be added to all web site urls automatically, for example;

http://www.example.com/index.php?r=perfil%2Fcreate&layout=45454578

This parameter layout=45454578, must come from the database and be added automatically when you initialize the application.

Can anyone help?

EDITED

For example; When the user accesses the site I pass the following link: www.example.com/index.php?layout=4545455, so I would be able to know which layout to use, but how do I keep this parameter layout=4545455 on all routes Site? Well if I click on the about menu it will be with the url www.example.com/index.php?r=site/about

I like to handle my urls in UrlRules. Maybe this will help you: http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html#creating-rules

In createUrl() you append the layout parameter for each url.