> For the complete documentation index, see [llms.txt](https://docs.allthingsghl.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.allthingsghl.com/dashboard/hide-menu-by-location.md).

# Hide Menu Items by Location

```javascript
  (function () {
    // List of location IDs where the menu items should be hidden
    const hiddenMenuLocationIds = [
      'CY3NuKb45jDC4NkqpHV3',
      'Sr99nTAsuyDCbfQCL1JQ',
      '1yOGYfoijdDCBjR2YTJ5',
      'L7bCRcMLEmDCtNi77ZQQ',
    ];
    
    // CSS selectors for menu items and elements to hide per location
    const menuSelectorsToHide = [
      '#sb_ai-employee-promo',
      'a[href*="ai-agents"]',
      '#sb_ai-agents',
      '.sidebar-v2-menu-item[href*="/ai-agents"]',
      '[id="sb_AI Agents"]',
      '#sb_location-mobile-app', 
      '#chat-connect',
      '#fb-connect',
      '#launchpad-chatwidget-connect',
      '#whatsapp-connect',
      '#launchpad-stripe-connect',
      '#invite-user',
      '#sb_reporting',
      '#tb_reputations-requests',
      '#tb_quiz-builder',
      '#tb_online-listings',
      '#sb_memberships',
      '#sb_app-marketplace',
      '#reputation-yext-overview-card',
      '#sb_objects',
      '#sb_agency-dashboard',
      '#sb_whatsapp',
      '#sb_ai_agent_settings',
      '#sb_Opportunities-Pipelines',
      '#sb_undefined',
      '#sb_conversations_providers',
      '#sb_brand-boards',
      '#tb_manual-actions',
      '#pendo-base',
      '#pendo-g-5XkyCm3qauAbDY5lupfi7SwX1wA',
      '#sb_business-settings-v2',
      '#sb_labs',
      '#sb_url-redirects',
      '#sb_manage-scoring',
      '#sb_reputation-management'
    ];

    function hideMenuItemsForLocation() {
      const locationId = app?.__vue__?.currentLocationId;
      
      // ADD DEBUG LOGGING
      console.log('=== MENU HIDING DEBUG ===');
      console.log('Current location ID:', locationId);
      console.log('Hidden location IDs:', hiddenMenuLocationIds);
      console.log('Should hide?', hiddenMenuLocationIds.includes(locationId));
      
      // Check if locationId exists
      if (!locationId) {
        console.log('No location ID found - not hiding anything');
        return;
      }
      
      // Only hide if this location is in the hidden list
      if (hiddenMenuLocationIds.includes(locationId)) {
        console.log('HIDING elements for location:', locationId);
        menuSelectorsToHide.forEach((selector) => {
          const elements = document.querySelectorAll(selector);
          console.log(`Hiding ${elements.length} elements for selector: ${selector}`);
          elements.forEach((el) => {
            el.style.display = 'none';
          });
        });
      } else {
        console.log('NOT hiding - location not in hidden list:', locationId);
        // IMPORTANT: Unhide elements if they were previously hidden
        menuSelectorsToHide.forEach((selector) => {
          const elements = document.querySelectorAll(selector);
          elements.forEach((el) => {
            // Only unhide if we previously hid it
            if (el.style.display === 'none') {
              console.log('Unhiding element:', selector);
              el.style.display = '';
            }
          });
        });
      }
    }

    function mutationCallback(mutationsList, observer) {
      for (const mutation of mutationsList) {
        if (mutation.type === 'childList') {
          hideMenuItemsForLocation();
        }
      }
    }

    const observer = new MutationObserver(mutationCallback);
    const config = { childList: true, subtree: true };
    observer.observe(document.body, config);
    hideMenuItemsForLocation(); // Initial run
  })();
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.allthingsghl.com/dashboard/hide-menu-by-location.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
