Skip to content

getnacelle/nacelle-littledata-nuxt-module

Repository files navigation

[DEPRECATED]

This package is deprecated. To integrate a third party script with your Nuxt project, follow our docs here: https://docs.getnacelle.com/nuxt/external-scripts.html

Nacelle Littledata Nuxt Module

Integrate Littledata in your Nacelle Nuxt Starter project

nacelle-littledata-nuxt-module

This plugin makes it easier to add the Google Analytics client ID to checkout attributes, as documented in step 4 of Littledata's headless setup guide.

Prerequisites

Add Module to Nacelle

Once you have Nacelle, Google Analytics and Littledata set up you can install this module in your project from npm:

npm install @nacelle/nacelle-littledata-nuxt-module --save

In nuxt.config.js, add @nacelle/nacelle-littledata-nuxt-module to the modules array:

modules: [
  // ...other modules,
  '@nacelle/nacelle-littledata-nuxt-module'
],

Finally, use the $getLittledataMetafield function to add the Google Analytics client ID to $nacelle.checkout.process:

const processCheckoutObject = await this.$nacelle.checkout.process({
  cartItems: getters.checkoutLineItems,
  checkoutId: getters.checkoutIdForBackend,
  metafields: [await this.$getLittledataMetafield()],
});