or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-3/

Analytics Configuration Setup

You need to create a configuration system for a Nuxt.js 2 application that sets up analytics tracking with support for both development and production environments.

Requirements

Configuration Module

Create a Nuxt.js configuration file that:

  • Integrates an analytics module as a build module
  • Configures the tracking ID to be "UA-123456-7"
  • Enables the module in both development and production environments
  • Prevents actual data transmission to the analytics service during development
  • Supports runtime configuration for dynamic tracking ID assignment

Configuration Validation

Create a simple test to verify:

  • The module is properly registered as a build module
  • The tracking ID is correctly set
  • Development mode is explicitly enabled
  • Debug mode configuration is present with appropriate settings
  • Runtime configuration is properly structured

Implementation

@generates

API

// nuxt.config.js exports a configuration object
export default {
  buildModules: Array,
  googleAnalytics: Object,
  publicRuntimeConfig: Object
}

Test Cases

  • The configuration includes the analytics module in buildModules @test
  • The tracking ID is set to "UA-123456-7" @test
  • Development mode is enabled @test
  • Debug sendHitTask is disabled to prevent data transmission @test

Dependencies { .dependencies }

@nuxtjs/google-analytics { .dependency }

Provides Google Analytics integration for Nuxt.js applications.