---
title: "Performance · Nuxt Scripts"
description: "Defer the Maps JavaScript API, reserve map space, and reduce unnecessary dynamic map loads."
canonical_url: "https://scripts.nuxt.com/scripts/google-maps/guides/performance"
meta:
  "og:description": "Defer the Maps JavaScript API, reserve map space, and reduce unnecessary dynamic map loads."
  "og:image": "https://scripts.nuxt.com/_og/s/o_24d85ad558cd955d.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Performance · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_24d85ad558cd955d.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Guides**

# **Performance**

[Copy for LLMs](https://scripts.nuxt.com/scripts/google-maps/guides/performance.md)

`**ScriptGoogleMaps**` waits for an interaction before requesting the Maps JavaScript API. The placeholder slot stays empty unless you add a static map or another preview. Google also recommends the API's asynchronous loading path, which the Nuxt Scripts registry uses through `**loading=async**` and a callback. See Google's [**loading guide**](https://developers.google.com/maps/documentation/javascript/load-maps-js-api).

## Loading Strategies

### Default: lazy

By default, the map loads on `**mouseenter**`, `**mouseover**`, or `**mousedown**`. A page view that never triggers the map does not load the Maps JavaScript API.

```vue
<template>
  <!-- Loads JS API on first hover/click -->
  <ScriptGoogleMaps
    :map-options="{
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 12,
    }"
  />
</template>
```

### Immediate loading

Skips the interaction gate, but still waits for client hydration and Nuxt's idle callback before loading the JavaScript API. Use this when the map is primary content and should become interactive soon after hydration.

```vue
<template>
  <ScriptGoogleMaps
    trigger="immediate"
    :map-options="{
      center: { lat: -33.8688, lng: 151.2093 },
      zoom: 12,
    }"
  />
</template>
```

A map load triggers the [**Dynamic Maps SKU**](https://developers.google.com/maps/documentation/javascript/usage-and-billing), regardless of which trigger starts it. With `**trigger="immediate"**`, every visit that renders the component can become a map load. See [**Billing & Permissions**](https://scripts.nuxt.com/scripts/google-maps/guides/billing) for current prices.

### Custom triggers

You can control exactly when the map loads using any [**Element Event Trigger**](https://scripts.nuxt.com/docs/guides/script-triggers#element-event-triggers).

```vue
<template>
  <!-- Only load on explicit click -->
  <ScriptGoogleMaps trigger="mousedown" />

  <!-- Load when element enters viewport -->
  <ScriptGoogleMaps trigger="visible" />
</template>
```

## Placeholder optimization

### Above the fold

When the map is visible without scrolling, use the `**#placeholder**` slot to provide an eagerly loaded custom image and avoid Static Maps API charges.

### Custom Placeholder

The slot is empty by default. Add your own preview without creating a Static Maps API event; see the [`**#placeholder**`** slot**](https://scripts.nuxt.com/scripts/google-maps/api/script-google-maps#slots) for usage.

## Marker performance

When rendering many markers, consider [**marker clustering**](https://scripts.nuxt.com/scripts/google-maps/guides/marker-clustering). At lower zoom levels, the clusterer replaces groups of nearby markers with one cluster marker; Google describes this as a way to improve readability when markers are close together in its [**marker clustering guide**](https://developers.google.com/maps/documentation/javascript/marker-clustering).

See [**Billing & Permissions**](https://scripts.nuxt.com/scripts/google-maps/guides/billing) for a full cost breakdown and optimization strategies.

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/google-maps/1.guides/1.performance.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/google-maps/guides/performance.md)

[**Google Analytics** Send Google Analytics page views and events with typed consent controls.](https://scripts.nuxt.com/scripts/google-analytics) [**Map Styling** Style interactive and static maps with JSON rules, cloud map IDs, and color mode.](https://scripts.nuxt.com/scripts/google-maps/guides/map-styling)

**On this page **

- [Loading Strategies](#loading-strategies)
- [Placeholder optimization](#placeholder-optimization)
- [Marker performance](#marker-performance)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/google-maps/guides/performance#webpage","@type":"WebPage","description":"Defer the Maps JavaScript API, reserve map space, and reduce unnecessary dynamic map loads.","name":"Performance","url":"https://scripts.nuxt.com/scripts/google-maps/guides/performance","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/google-maps/guides/performance#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/google-maps/guides/performance"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/google-maps/guides/performance#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"Google Maps","item":"https://scripts.nuxt.com/scripts/google-maps","position":3},{"@type":"ListItem","name":"Guides","item":"https://scripts.nuxt.com/scripts/google-maps/guides","position":4},{"@type":"ListItem","name":"Performance","item":"https://scripts.nuxt.com/scripts/google-maps/guides/performance","position":5}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
