# init
A JSON object containing a snapshot of the page at time of page render. It will always have the present `Context` of the page, as well as the `Data` field, which provides access to the `Cart` and `Customer` objects.
### Accessing Standard Api

```javascript
import {register} from '@shopify/web-pixels-extension';

register(({analytics, init}) => {
  analytics.subscribe('page_viewed', (event) => {
    // On every page view, get the current state of the cart

    const customer = init.data.customer;
    const cart = init.data.cart;
    const shop = init.data.shop;
    const purchasingCompany = init.data.purchasingCompany;

    console.log(`Customer Name: ${customer.firstName}`);
    // Customer Name: Bogus

    console.log(`Total Number of Items in Cart: ${cart.totalQuantity}`);
    // Total Number of Items in Cart: 3

    console.log(`Total Cost of Cart: ${cart.cost.totalAmount.amount}`);
    // Total Cost of Cart: 50.82

    console.log(`Shop name: ${shop.name}`);
    // Shop name: Shop 123

    console.log(`Shop currency code: ${shop.paymentSettings.currencyCode}`);
    // Shop currency code: CAD

    console.log(`Purchasing company name: ${purchasingCompany.company.name}`);
    // Purchasing company name: Acme Corporation

    console.log(
      `Purchasing company location name: ${purchasingCompany.location.name}`,
    );
    // Purchasing company location name: Toronto fulfillment center
  });
});

```

```javascript
analytics.subscribe('page_viewed', (event) => {
  // On every page view, get the current state of the cart

  const customer = init.data.customer;
  const cart = init.data.cart;
  const shop = init.data.shop;
  const purchasingCompany = init.data.purchasingCompany;

  console.log(`Customer Name: ${customer.firstName}`);
  // Customer Name: Bogus

  console.log(`Total Number of Items in Cart: ${cart.totalQuantity}`);
  // Total Number of Items in Cart: 3

  console.log(`Total Cost of Cart: ${cart.cost.totalAmount.amount}`);
  // Total Cost of Cart: 50.82

  console.log(`Shop name: ${shop.name}`);
  // Shop name: Shop 123

  console.log(`Shop currency code: ${shop.paymentSettings.currencyCode}`);
  // Shop currency code: CAD

  console.log(`Purchasing company name: ${purchasingCompany.company.name}`);
  // Purchasing company name: Acme Corporation

  console.log(
    `Purchasing company location name: ${purchasingCompany.location.name}`,
  );
  // Purchasing company location name: Toronto fulfillment center
});

```


## Properties

### Init

### context

### customerPrivacy

### data

### CustomerPrivacyData

### analyticsProcessingAllowed
This flag indicates whether the customer has allowed the processing of their data for analytics purposes on the initial page load.  If a customer submits consent, you can use the [customer privacy API](/api/web-pixels-api/pixel-privacy#customer-privacy-api) to track whether or not the privacy permissions have changed.
### marketingAllowed
This flag indicates whether the customer has allowed the processing of their data for marketing purposes on the initial page load. If a customer submits consent, you can use the [customer privacy API](/api/web-pixels-api/pixel-privacy#customer-privacy-api) to track whether or not the privacy permissions have changed.
### preferencesProcessingAllowed
This flag indicates whether the customer has allowed the processing of their data for preferences purposes on the initial page load. If a customer submits consent, you can use the [customer privacy API](/api/web-pixels-api/pixel-privacy#customer-privacy-api) to track whether or not the privacy permissions have changed.
### saleOfDataAllowed
This flag indicates whether the customer has allowed the sale of their data on the initial page load. If a customer submits consent, you can use the [customer privacy API](/api/web-pixels-api/pixel-privacy#customer-privacy-api) to track whether or not the privacy permissions have changed.
### RegisterInitData

### cart
A cart represents the merchandise that a customer intends to purchase, and the estimated cost associated with the cart.
### customer
A customer represents a customer account with the shop. Customer accounts store contact information for the customer, saving logged-in customers the trouble of having to provide it at every checkout.
### purchasingCompany
Provides details of the company and the company location that the business customer is purchasing on behalf of. This includes information that can be used to identify the company and the company location that the business customer belongs to.
### shop
The shop represents information about the store, such as the store name and currency.
### Cart
A cart represents the merchandise that a customer intends to purchase, and the estimated cost associated with the cart.
### attributes
The attributes associated with the cart. This property is only available if the shop has [upgraded to Checkout Extensibility](https://help.shopify.com/en/manual/checkout-settings/checkout-extensibility/checkout-upgrade).
### cost
The estimated costs that the customer will pay at checkout.
### id
A globally unique identifier.
### lines
A list of lines containing information about the items the customer intends to purchase.
### totalQuantity
The total number of items in the cart.
### Attribute
Custom attributes associated with the cart or checkout.
### key
The key for the attribute.
### value
The value for the attribute.
### CartCost
The costs that the customer will pay at checkout. It uses [`CartBuyerIdentity`](https://shopify.dev/api/storefront/reference/cart/cartbuyeridentity) to determine [international pricing](https://shopify.dev/custom-storefronts/internationalization/international-pricing#create-a-cart).
### totalAmount
The total amount for the customer to pay.
### MoneyV2
A monetary value with currency.
### amount
The decimal money amount.
### currencyCode
The three-letter code that represents the currency, for example, USD. Supported codes include standard ISO 4217 codes, legacy codes, and non- standard codes.
### CartLine
Information about the merchandise in the cart.
### cost
The cost of the merchandise that the customer will pay for at checkout. The costs are subject to change and changes will be reflected at checkout.
### merchandise
The merchandise that the buyer intends to purchase.
### quantity
The quantity of the merchandise that the customer intends to purchase.
### CartLineCost
The cost of the merchandise line that the customer will pay at checkout.
### totalAmount
The total cost of the merchandise line.
### ProductVariant
A product variant represents a different version of a product, such as differing sizes or differing colors.
### id
A globally unique identifier.
### image
Image associated with the product variant. This field falls back to the product image if no image is available.
### price
The product variant’s price.
### product
The product object that the product variant belongs to.
### sku
The SKU (stock keeping unit) associated with the variant.
### title
The product variant’s title.
### untranslatedTitle
The product variant’s untranslated title.
### Image
An image resource.
### src
The location of the image as a URL.
### Product
A product is an individual item for sale in a Shopify store.
### id
The ID of the product.
### title
The product’s title.
### type
The [product type](https://help.shopify.com/en/manual/products/details/product-type) specified by the merchant.
### untranslatedTitle
The product’s untranslated title.
### url
The relative URL of the product.
### vendor
The product’s vendor name.
### Customer
A customer represents a customer account with the shop. Customer accounts store contact information for the customer, saving logged-in customers the trouble of having to provide it at every checkout.
### email
The customer’s email address.
### firstName
The customer’s first name.
### id
The ID of the customer.
### lastName
The customer’s last name.
### ordersCount
The total number of orders that the customer has placed.
### phone
The customer’s phone number.
### PurchasingCompany
Provides details of the company and the company location that the business customer is purchasing on behalf of.
### company
Includes information of the company that the business customer is purchasing on behalf of.
### location
Includes information of the company location that the business customer is purchasing on behalf of.
### PurchasingCompanyCompany
Includes information of the company that the business customer is purchasing on behalf of.
### externalId
The external ID of the company that can be set by the merchant.
### id
The company ID.
### name
The name of the company.
### PurchasingCompanyLocation
Includes information of the company location that the business customer is purchasing on behalf of.
### externalId
The external ID of the company location that can be set by the merchant.
### id
The company location ID.
### name
The name of the company location.
### Shop
The shop represents information about the store, such as the store name and currency.
### countryCode
The shop’s country code.
### myshopifyDomain
The shop’s myshopify.com domain.
### name
The shop’s name.
### paymentSettings
Settings related to payments.
### storefrontUrl
The shop’s primary storefront URL.
### ShopPaymentSettings
Settings related to payments.
### currencyCode
The three-letter code for the shop’s primary currency.