Google

Connect DocLayer to Google products through built-in adapters

Google adapters connect a DocLayer app to Google products from one place. Each section on this page is one product. They share the same setup shape: a public identifier in app.config.ts, and a call from your app when the adapter has to run during render.

Analytics

NameTypeIDData Handling
GoogleAnalytics
analytics-google
Client

Google Analytics records page (app) visits with a Google tag (gtag.js). The adapter writes that tag into the document head while the page is rendering on the server, using the measurement identifier you provide.

In your Google Analytics panel, open the web stream and copy the measurement id (tag). It looks like G-XXXX. Then register the adapter in app.config.ts.

import { gaAdapter } from '@vuehouse/dl/exports';// You can also call it with the `googleAnalyticsAdapter` aliasexport default defineDoclayerAppConfig({  // the rest of the config  dl: {    adapters: {      // use array if you use multiple adapters      analytics: gaAdapter('analytics-google', {        tag: 'G-XXXX',      }),    },  },});

The adapter is an effect, so call it from script setup of a component that is part of the server render. app.vue runs once for the whole application, which is the usual place for a site-wide tag:

<script setup lang="ts">const { dl } = useAppConfig();dl.adapters.analytics?.();// or run it from array if you use multiple adaptersconst [google, posthog] = dl.adapters.analytics;google?.();posthog?.();</script>

During that setup, the adapter pushes the gtag script onto the server context, then including those in the HTML response.

The measurement tag is public, and DocLayer does not add an API routes for this adapter. The tag is part of the rendered page.