Zid Docs
Apps
ThemesPayments
Apps
ThemesPayments
Help Center
Slack
  1. Apps
  • πŸ—‚οΈ Overview
  • πŸš€ Start Here
  • Create your First App
  • Responses
  • Rate Limiting
  • Authorization
  • Embedded Apps
  • StoreFront Events
  • Zid MUI
  • Zid SDKs
  • Our custom MCP server
  • Merchant APIs
    • Account
      • Me
        • Me
        • Profile
      • Store
        • Store
        • Branding
        • Localization
        • Social
        • Operations
        • Business
        • Upload Logo Image
        • Delete Logo Image
        • Upload Icon Image
        • Delete Icon Image
        • Upload Cover Image
        • Delete Cover Image
    • Orders
      • Validate Order Request
      • Create Order
      • Change Order Status
      • Add Order Comment
      • View Order
      • List Orders
      • List Custom Order Statuses
      • List Order Credit Notes
    • Reverse Orders
      • Create Reverse Orders
      • Create Reverse Orders Waybill
      • Add Reverse Order Reasons
      • List Reverse Reasons
      • Calculate Reverse Totals
      • Create refund for reverse order
      • Upload bank transfer receipt
      • Update return products
      • Order Details – View for Return
    • Abandoned Carts
      • List Carts
      • View Cart
    • Products
      • Managing Products
        • Create Product Types
        • Create Product
        • List Products
        • View Product
        • List Product Settings
        • Update Product
        • Bulk Update Products
        • Delete Product
      • Digital Vouchers
        • List Vouchers
        • Order Vouchers
        • Create Voucher
        • Import Vouchers
        • Export Vouchers
        • Update Voucher
        • Remove Voucher
      • Product Categories
        • List Categories
        • View Category
        • Create Category
        • Create Subcategory
        • Update Category
        • Assign Product to Category
        • Bulk Assign Products to Category
        • Publish Category
        • Detach Category from All Products
        • Remove Product from Category
      • Product Badge
        • List Badges
      • Product Attributes
        • List Attributes
        • View Attribute
        • Create Attribute
        • Update Attribute
        • Delete Attribute
      • Product Attribute Presets
        • List Presets
        • Create Preset
        • Update Preset
        • Delete Preset
      • Product Variants
        • Create Variants
        • Create Custom Option
        • Update Custom Option
        • Delete Custom Option Field
        • Create Custom Input Field
        • Update Custom Input Field
        • Delete Custom Input Field
      • Product Sorting
        • Set Manual Product Order
        • Reset Manual Product Order
      • Product Images
        • List Images
        • Upload Image
        • Update Image Order
        • Delete Image
      • Product Availability Notifications
        • Notification Stats
        • Noticiation Settings
        • List Notifications
        • Create Notification
        • Update Settings
        • Send Notification Email
        • Export Notifications
      • Product Export
        • Email All Products to Store Owner
        • Import Products via CSV or xlsx File
      • Product Stock
        • Retrieve Product Stock
        • List Product Stock Records
        • Create Product Stock
        • Update Product Stock
        • Bulk Update Product Stock Records
      • Product Questions & Answers
        • Retrieve Product Question
        • Retrieve Product Answer
        • List Product Questions
        • List Answers for Question
        • Create Product Question
        • Create Product Answer
        • Update Product Question
        • Update Product Answer
        • Delete Product Question
        • Delete Product Answer
      • Product Reviews
        • List Reviews
        • Count Reviews
      • Digital Products
        • Create Downloadable Product
        • Generate Upload URL
        • Upload File to S3
        • Create Product Downloadable
        • Get Product Downloadables
        • Delete Product Downloadable
        • List Store Downloadables
        • Create Store Downloadable
        • Delete Store Downloadable
    • Inventories
      • Create Location
      • Update Location
      • Update Product Stock for Location
      • List Locations
      • View Location
    • Shipping
      • List Store Shipping Methods
    • Marketing
      • Coupons
        • List Coupons
        • View Coupon
        • Create Coupon
        • Generate Bulk Coupons
        • Duplicate Coupon
        • Duplicate Bulk Coupons
        • Update Coupon Note
        • Update Coupon
        • Update Bulk Coupons
        • Update Coupon Status
        • Update Bulk Coupons Status
        • Delete Coupon
        • Delete Bulk Coupons
      • Bundle Offers
        • List Bundle Offers
        • View Bundle Offer
      • Loyalty Program
        • Loyalty Program Status
        • Loyalty Program Details
        • Loyalty Program Info
        • Customer Loyalty Summary
        • Customer Points History
        • Activate Loyalty Program
        • Set Points Expiration Rules
        • Update Cashback Rule
        • Create Points Redemption Method
        • Update Points Redemption Method
        • Delete Points Redemption Method
        • Adjust Customer Points
      • Discount Rules
        • List Discount Rules
        • View Discount Rule
        • Create Discount Rule
        • Update Discount Rule
    • Customers
      • Customer Tags
        • List Customer Tags
        • Add Customer Tag
        • Ω’Update Customer Tag
        • Delete Customer Tag
      • List Customers
      • View Customer
      • Primary Customer List
      • FInd Customer By Phone Number
      • Customer Profile
      • Add Customer
      • Update Customer
      • Delete Customer
      • Add Bulk Customers
      • Import Customers
    • Store Settings
      • πŸ“„ User Roles and Permissions
      • Retrieve Store Manager Profile
      • Retrieve VAT Settings
      • List Payment Methods
      • List Store Operating Countries
    • Countries and Cities
      • List Countries
      • List Cities for Country
    • Blogs
      • Settings
        • Create
        • List
      • Categories
        • Create
        • List
        • Bulk Activate
        • Bulk Deactivate
        • Bulk Delete
        • Retrieve
        • Destroy
        • Partial Update
        • Bulk Add To Posts
        • Bulk Remove From Posts
      • Posts
        • Media
          • List
          • Create
          • Destroy
        • Create
        • List
        • Retrieve
        • Partial Update
        • Destroy
        • Archive
        • Publish
        • Bulk Archive
        • Bulk Publish
        • Bulk Delete
        • Export Posts
        • Import Template
        • Import Posts
      • Tags
        • Create
        • List
        • Retrieve
        • Partial Update
        • Destroy
        • Bulk Delete Tags
        • Bulk Add To Posts
        • Bulk Remove From Posts
      • Storefront
        • Posts
          • List
          • Retrieve
        • Categories
          • List
          • Retrieve
        • Tags
          • List
  • Webhooks
    • Overview
    • Webhook Health Tracking
    • Events
      • Order
      • Product
      • Abandoned Cart
      • Customer
      • Product Category
    • APIs
      • Health Summary
      • Broken Webhooks
      • Recover Broken Webhooks
      • List Webhooks
      • Create Webhook
      • Delete Webhook
      • Delete Webhook By subscriber
  • App Management
    • Events
    • APIs
      • Subscription Details
      • Update Usage-Based Charges
  1. Apps

StoreFront Events

Zid App Scripts allow merchants to inject custom JavaScript directly into their storefront through the Partner Dashboard. This enables dynamic user interactions and personalized experiences.
This documentation outlines the process of injecting global scripts and implementing event-specific scripts that respond to user actions in real-time.

Recommended Use Case#

Tracking Storefront Events (for Apps)
If you are building an app inside the Zid Dashboard (either embedded app or external) and need to track storefront events via an injected JavaScript snippet, use the following supported storefront events.
These events are officially exposed for client-side tracking and integration.

Global and Customer Object Scripting#

Zid's API supports global objects for advanced scripting that load upon page initialization.

Global Objects#

ObjectDescription
window.customerContains details of the logged-in customer. Empty if no user is logged in.
window.customerAuthStateAuthentication state object (available immediately on page load).
window.customerAsyncA Promise that resolves with the customer data once fetched. Useful for async operations when window.customer is not yet available.

Customer Object Blueprint:#

ParameterDescription
idUnique identifier for the customer
nameFull name of the customer
firstnameFirst name (derived from full name)
lastnameLast name (derived from full name)
mobileMobile number of the customer
emailEmail address of the customer

customerAuthState Object:#

ParameterDescription
isAuthenticatedtrue if the user is logged in, false otherwise
isGuesttrue if the user is a guest, false otherwise
These global objects enable dynamic interactions and personalized user experiences.

Event-Driven Scripting#

Zid supports event-driven scripting, allowing JavaScript execution in response to specific storefront events. These events trigger JavaScript functions to track user interactions and enhance engagement.
Supported Events:
1.
Purchase Event
2.
Product View Event
3.
Add to Cart Event
4.
Remove from Cart Event
5.
Start Checkout Event
6.
View Item List Event (New)
7.
Select Item Event (New)
(Please note that productCart refers to the product in the cart, and productViewd refers to the viewed product. The unconventional spelling is consistent with the codebase.)

1. Purchase Event#

ParameterDescription
orderThe full order object containing all order details.
transaction_idOrder ID.
valueTotal order value.
currencyCurrency code (e.g., SAR).
itemsArray of purchased items (see below).
Items Array:
ParameterDescription
------
item_idProduct ID
item_nameProduct Name
item_skuProduct SKU code
priceProduct Price
quantityProduct Quantity
item_categoryProduct Category Name (if available)

Legacy System#

In the old system, transactionItems was passed as a flat array of products:
ParameterDescription
transactionItemsList of products the user purchased.
idOrder Id
product idProduct Id
nameProduct Name
skuProduct Sku code
categoryProduct Category Name
priceProduct Price
quantityProduct Quantity
currencycurrency
totalProduct Total

2. Product View Event#

ParameterDescription
productViewdSingle product details object.
idProduct Id
nameProduct Name
skuProduct SKU code
categoryProduct Category Name
priceProduct Price
positionDisplay Order

3. Add to Cart Event#

ParameterDescription
productCartSingle product cart object.
idProduct Id
nameProduct Name
skuProduct SKU code
categoryProduct Category Name
priceProduct Price
positionDisplay Order
quantityProduct Quantity

4. Remove from Cart Event#

ParameterDescription
productCartSingle product cart object.
idProduct Id
nameProduct Name
skuProduct SKU code
categoryProduct Category Name
priceProduct Price
positionDisplay Order
quantityProduct Quantity

5. Start Checkout Event#

The start checkout event now receives the full cart object:
ParameterDescription
idUnique identifier for the shopping cart.
session_idSession identifier.
productsArray of cart products (see below).
products_countTotal number of products in the cart.
products_subtotalSubtotal of all products before discounts/shipping.
totalsArray of totals (subtotal, tax, shipping, total).
currencyCurrency object with cart_currency.code.
couponApplied coupon object (if any).
Cart Products Array:
ParameterDescription
-------------------------------------------------------------------------------
product_idProduct ID.
nameProduct name.
skuProduct SKU code.
priceProduct price.
quantityQuantity in cart.

Legacy System#

In the old system, the event received flat parameters:
ParameterDescription
cart_idUnique identifier for the shopping cart.
cart_totalTotal value of the cart.
currencyCurrency used for the transaction.
itemsList of items in the cart, each represented by its own object.
item_idUnique identifier for each product in the cart.
item_nameName of the product.
item_pricePrice of the product.
item_quantityQuantity of the product in the cart.
item_categoryCategory of the product.
user_idUnique identifier of the user (if logged in).
session_idUnique identifier for the session (if user is not logged in).
cart_discountAny discount applied to the cart.
shipping_costEstimated shipping cost for the cart.
checkout_stepCurrent step in the checkout process (e.g., shipping, payment, confirmation).
payment_methodSelected payment method (if chosen).

6. View Item List Event (New)#

Fired when a user views a list of products (e.g., category page, search results, product listing).
ParameterDescription
listNameName of the list (e.g., category name, "all_products").
productsArray of products in the list (see below).
Products Array:
ParameterDescription
-------------------------------------------------------------------------------
item_idProduct ID.
item_nameProduct name.
item_skuProduct SKU code.
currencyCurrency code.
priceProduct price.
quantityProduct quantity.
item_categoryProduct category name (if available).

7. Select Item Event (New)#

Fired when a user clicks on a product in a list to view its details.
ParameterDescription
productProduct object (same structure as productViewd).
listNameName of the list where the product was selected.

Script Injection for App Partners#

Custom Snippets allow you to inject scripts into stores where your app is installed, enabling enhanced functionality, better store customization, and seamless integration. This feature provides flexibility to optimize the merchant experience without requiring them to manually modify their store's code.

How to Enable Custom Snippets#

Group 1321314716.png
Before publishing, always test your changes in a development store to ensure smooth functionality. Optimize scripts for performance to prevent any impact on storefront loading times.
1.
Open the Partner Dashboard and navigate to the General Settings of your app.
2.
Click on Add Snippet and enter your JavaScript or CSS snippet in the provided field.
3.
Define the snippet's placement and configure any required parameters.
4.
Submit your changes for review and approval. You can modify or remove the snippet from your app at any time.
Modified atΒ 2026-02-24 17:14:15
Previous
Embedded Apps
Next
Zid MUI
Built with