Documentation
Feedback
Guides

Release Notes
Release Notes
Fixed
FastStore v1: Fixed abandoned cart tracking
October, 11

We have implemented a solution to ensure correct tracking and monitoring of abandoned carts and analytics data for stores currently on FastStorev1. Stores using this version of FastStore must update their project code with the new VTEX_METADATA object.

This change only affects stores using FastStore v1.

What has changed?

Before, stores faced issues with tracking abandoned carts, as they were receiving a null value. This resulted in an inability to track whether customers completed their purchases or not when they added items to their carts. As a result, sending cart reminders or notifications was a challenge.

Now, by implementing the VTEX_METADATA object, you can set the correct account information, ensuring proper tracking of abandoned carts and analytics data for Return Customer (RC) and Activity Flow (AF) analytics trackers from VTEX.

What needs to be done?

Stores using FastStore v1 must define the VTEX_METADATA object to ensure the correct behavior. To do so, open your FastStore project code and follow the steps below:

  1. In the src/sdk/analytics/index.tsx file, add the highlighted code:


    _10
    if (typeof window !== 'undefined') {
    _10
    window.dataLayer = window.dataLayer ?? []
    _10
    window.VTEX_METADATA = {
    _10
    account: storeConfig.api.storeId,
    _10
    renderer: 'faststore',
    _10
    }
    _10
    }

  2. In the src/typings/global.d.ts file, add the highlighted code:


    _11
    declare module '*.scss';
    _11
    declare module '*.png';
    _11
    _11
    interface Window extends Window {
    _11
    dataLayer: any[];
    _11
    VTEX_METADATA: {
    _11
    account: string,
    _11
    renderer: "faststore"
    _11
    };
    _11
    sendrc: (eventName: string, eventValues?: any) => void
    _11
    }

  3. In the terminal, run yarn dev to sync the changes.

After syncing the changes, you can test the solution by checking the information in the following topics:

  • Check if VTEX_METADATA has been defined:

    1. Access the provided localhost URL in your browser.
    2. Open the Dev Tools terminal, go to the Console tab, and check if the window.VTEX_METADATA is defined in the console, as illustrated in the image below.

    {"base64":"  ","img":{"width":1874,"height":691,"type":"gif","mime":"image/gif","wUnits":"px","hUnits":"px","length":633024,"url":"https://vtexhelp.vtexassets.com/assets/docs/src/console-vtex-metadata___f1d9f78c17949decc87f22266ac3285d.gif"}}

  • Check if the data captured by Return Customer (RC) is updating the records in Master Data:

    Refer to the topic Is the data captured by RC updating the records in Master Data?.

Was this helpful?
Yes
No
On this page