@bond-london/gatsby-plugin-cookie-scripts
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@bond-london/gatsby-plugin-cookie-scripts

Manage cookies and tracking scripts

Features

  • Optionally installs tracking scripts when cookies are accepted
  • Can track page changes (ie route updates)

How to use

Install package

yarn add @bond-london/gatsby-plugin-cookie-scripts

Configure the plugin

// In your gatsby-config.js
plugins: [
  {
    resolve: `gatsby-source-filesystem`,
    options: {
      path: `${__dirname}/locales`,
      name: `locale`,
    },
  },
  {
    resolve: `@bond-london/gatsby-plugin-cms-i18next`,
    options: {
      localeJsonSourceName: `locale`, // name given to `gatsby-source-filesystem` plugin.
      defaultLanguage: `en`,
      // if you are using Helmet, you must include siteUrl, and make sure you add http:https
      siteUrl: `https://example.com/`,
      // you can pass any i18next options
      i18nextOptions: {
        interpolation: {
          escapeValue: false, // not needed for react as it escapes by default
        },
        keySeparator: false,
        nsSeparator: false,
      },
      pages: [
        {
          matchPath: "/:lang?/blog/:uid",
          getLanguageFromPath: true,
          excludeLanguages: ["es"],
        },
        {
          matchPath: "/preview",
          languages: ["en"],
        },
      ],
    },
  },
];

License

MIT © Bond London

Package Sidebar

Install

npm i @bond-london/gatsby-plugin-cookie-scripts

Weekly Downloads

0

Version

2.0.1

License

MIT

Unpacked Size

25.2 kB

Total Files

29

Last publish

Collaborators

  • nrandell