npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@eternal-baguette/shopify

v1.9.18

Published

The `@coveo/shopify` package provides utilities to integrate Shopify with Coveo's commerce engine.

Downloads

747

Readme

@coveo/shopify

The @coveo/shopify package provides utilities to integrate Shopify with Coveo's commerce engine.

It includes functions to fetch app proxy configurations and build a commerce engine tailored for Shopify.

Benefits

Using the @coveo/shopify package ensures that the commerce engine will activate Shopify Web Pixels by emitting an event that contains everything they need to ensure consistent tracking and personalization across storefronts and pixels.

Installation

Install the package using npm or yarn:

npm install @coveo/shopify
# or
yarn add @coveo/shopify

Features

init

Initializes the Coveo Shopify integration to ensure that web pixels work correctly. This function should be called on every page of your Shopify store to maintain consistent tracking and personalization.

The init function publishes a custom event with the configuration data that the web pixels need to function properly.

Parameters

  • options (required): A CoveoShopifyOptions object containing:
    • accessToken (required): The access token for the Coveo API.
    • organizationId (required): The organization ID.
    • environment (required): The environment configuration ('dev', 'stg', 'prod', etc.).
    • trackingId (required): The tracking ID for analytics.

Returns

This function doesn't return a value but publishes a custom event that web pixels can listen to.

Example

import {init} from '@eternal-baguette/shopify/utilities';

// Initialize on every page
init({
  accessToken: 'your-access-token',
  organizationId: 'your-org-id',
  environment: 'prod',
  trackingId: 'your-tracking-id',
});

Usage with App Proxy Configuration

You can combine the init function with fetchAppProxyConfig to initialize the integration:

import {init, fetchAppProxyConfig} from '@eternal-baguette/shopify/utilities';

const config = await fetchAppProxyConfig({
  marketId: 'market_123432',
});

init(config);

fetchAppProxyConfig

Fetches the app proxy configuration for a given Shopify market.

Parameters

  • marketId (required): The market identifier.
  • appProxyUrl (optional): The URL of the app proxy. Defaults to '/apps/coveo'. Useful if implementing your own custom proxy.

Returns

A promise that resolves to an object containing:

  • accessToken: The access token for the app proxy.
  • organizationId: The organization ID.
  • environment: The environment configuration.
  • trackingId: The tracking ID.

Example

import {fetchAppProxyConfig} from '@eternal-baguette/shopify/headless/commerce';

const config = await fetchAppProxyConfig({
  marketId: 'market_123432',
});
console.log(config);

buildShopifyCommerceEngine

Builds a commerce engine instance configured for Shopify.

Parameters

  • commerceEngineOptions (required): Options for the commerce engine.

Returns

A configured commerce engine instance.

Example

<script type="module">
import {buildShopifyCommerceEngine, fetchAppProxyConfig} from 'https://static.cloud.coveo.com/shopify/v1/headless/commerce.esm.js';

const config = await fetchAppProxyConfig({marketId: 'market_123432'});
const engine = buildShopifyCommerceEngine({
  commerceEngineOptions: {
    configuration : {
      accessToken: config.accessToken,
      organizationId: config.organizationId,
      environment: config.environment,
      analytics: {
        enabled: true,
        trackingId: config.trackingId,
      },
      context: {
        country: {{ localization.country.iso_code | json }},
        currency: {{  localization.country.currency.iso_code | json }},
        view: {
          url: {{ canonical_url | json }},
        },
        language: {{ request.locale.iso_code | json }},
        cart: {{ cart.items | json }}.map(function (item) {
          return {
            productId: `gid://shopify/ProductVariant/${item.variant_id}`,
            name: item.title,
            price: item.final_price,
            quantity: item.quantity,
          };
        }),
      }
  },
});
console.log(engine);
</script>

Key constants:

  • COVEO_SHOPIFY_CONFIG_KEY: The key for the custom event and cookie used to share app proxy configuration (coveo_shopify_config).