Page Speed: Minimize cookie size

Keeping cookies as small as possible ensures that an HTTP request can fit into a single packet.

recommends:

Use server-side storage for most of the cookie payload

Store only a unique identifier in the cookie, and key the ID to data stored at the server end. You can use server-side cookies for both session and persistent cookies by specifying the expiry date/time on the cookie.

Remove unused or duplicated cookie fields

The fields set by a cookie at the top-level path of a domain (i.e. /) are inherited by the resources served off all paths below that domain. Therefore, if you are serving different applications on different URL paths, and you have a field that applies globally to all applications on a domain - for example, a user's language preference - include that field in the cookie set at the top-level domain; don't duplicate the field in cookies set for subpaths. Conversely, if a field only applies to an application served from a subpath - for example, a UI setting - don't include that field in the top-level cookie and force the unused data to be passed needlessly for other applications.

Read More

Have an idea for this recommendation?

Feel free to contact us with your suggestions, links or ideas!