How do i auto stack tabs but only if from same domain

I see how to have a new tab open in the same stack as in the stack I clicked to it from but I don't want unrelated tabs in a stack.
For example, my Google tab has mail, calendar, and search tabs all living on one stacked tab, but when I click on a link from my email or a search it opens there on the Google stack where it doesn't belong, it should open as a new tab or even open in another stack if from the same TLD. Anyone know?
Thanks folks.

Are we talking in respect of Firefox?

" Create Separate Firefox Tabs

Based on the provided search results, it’s not possible to create separate stacks of tabs from the same domain in Firefox using native features or settings. However, there are a few workarounds and extensions that can help achieve similar functionality:

  1. Tab Groups: Although Firefox no longer has native support for Tab Groups (previously known as Panorama), you can install the “Tab Groups by Quicksaver” extension (available on the Firefox Add-ons page). This extension allows you to group similar tabs together, including those from the same domain.
  2. Pinned Tabs: Pinning a tab allows you to keep a favorite site open and just a click away. You can pin multiple tabs at once by selecting them (Ctrl-click/Command-click) and then right-clicking/control-clicking on one of them and selecting “Pin Tabs.” This won’t create separate stacks, but it will keep the pinned tabs organized and easily accessible.
  3. Bookmarking Tabs: You can bookmark multiple tabs at once (Ctrl-click/Command-click on each tab, then right-click/control-click on one of them and select “Bookmark Tabs”). This will create a new folder containing bookmarks for each tab. While not exactly a separate stack, this can help organize your tabs by domain or topic.
  4. Third-party Extensions: Some extensions, like “OneTab” (available on the Firefox Add-ons page), can help manage tabs by consolidating multiple tabs into a single tab with a list of links. However, this might not provide the exact functionality you’re looking for.

If you’re looking for a more programmatic solution, you can try using Firefox’s Developer Edition and its WebExtensions API. You can create a custom extension that uses the tabs API to manage tabs and group them by domain. However, this requires programming expertise and is beyond the scope of this answer.

In summary, while there isn’t a native way to create separate stacks of tabs from the same domain in Firefox, you can use extensions like Tab Groups by Quicksaver, pinned tabs, bookmarking, or third-party extensions like OneTab to achieve similar organization and management of your tabs."