Using server events

Server side tracking events are now available. The same events fired on the client will also be sent on the server if the serverTrackers variable is present.

Copy
Copied
boot(
  <Theme>
    <Shop />
  </Theme>,
  {
    ...config,
    serverTrackers: [
      async (event, data, request) => {
        console.log(event);
      }
    ]
  }
);

Facebook CAPI

You can use the facebook server side tracking api by adding the following to you shop config under serverTrackers

Copy
Copied
import createFacebookTracker from '@jetshop/core/server/tracking/facebook';

const config = {
  serverTrackers: [
    createFacebookTracker({
      pixelId: process.env.FACEBOOK_PIXEL_ID,
      token: process.env.FACEBOOK_CAPI_TOKEN
    })
  ]
};

The following events will be tracked on the server for facebook: AddToCart, ViewContent, AddToWishlist, CompleteRegistration, InitiateCheckout, and PageView. For a full list of standard events and what is sent please refer to facebook's documentation here

Copyright © Norce 2023. All right reserved.