Installation

JavaScript Snippet

Copy and paste the following code into your site, just before the closing </head> tag or insert it into your GTM:

<script src="https://assets.lomadee.com/global/pixel.js" async></script>

Then initialize the Pixel in the global window context:

window.lomadeePixel = new LomadeeGlobalPixel();

How It Works

The Global Pixel is an asynchronous script responsible for tracking conversion events on your site. It handles:

  • Page view tracking
  • Link and button click tracking
  • Lomadee URL parameter capture

Sending Orders

On your conversion page, you can configure order sending to Lomadee using the sendOrder method, accessible through the global window context using the lomadeePixel variable.

lomadeePixel.sendOrder({
  orderId: "123456",
  customer: {
    id: "CUSTOMER_ID",
    firstName: "John",
    lastName: "Doe",
    email: "john@email.com",
    document: "12345678900",
    phone: "11999999999",
    documentType: "CPF",
    metadata: [],
  },
  items: [
    {
      id: "SKU123",
      name: "Smartphone XYZ",
      imageUrl: "https://example.com/image.jpg",
      price: 19999,
      listPrice: 24999,
      quantity: 1,
      categories: [
        {
          id: "CATEGORY_ID",
          name: "Electronics",
          metadata: [],
        },
      ],
      metadata: [],
    },
  ],
  subItems: [
    {
      key: "Items",
      value: 19999,
    },
    {
      key: "Shipping",
      value: 1599,
    },
    {
      key: "Discounts",
      value: -1999,
    },
  ],
  metadata: [],
});

Data Structure

orderId
string
required

Unique identifier for the order

customer
object
items
object
required
subItems
array
required

Array containing main order values

metadata
object
required

Additional order data

SubItems

The subItems object stores order information such as shipping, items, discounts, and other values not directly related to products. Important notes:

  • The total value of Items must reflect the final price of each product after applying discounts
  • Discounts applied directly to products should be reflected in each item’s price
  • General order discounts (such as coupons or payment method discounts) should be included in subItems using the Discounts key
  • Any other type of discount, such as fees, cashback, etc., should be included in subItems using a key with the discount name and value

Usage example:

lomadeePixel.sendOrder({
  // ... other fields ...
  items: [
    {
      id: "SKU123",
      name: "Smartphone XYZ",
      price: 18999, // Final price after $100 discount
      listPrice: 19999, // Original price
      quantity: 1,
      // ... other item fields
    },
  ],
  subItems: [
    {
      key: "Items",
      value: 18999, // Total sum of items (final prices)
    },
    {
      key: "Shipping",
      value: 1590, // Shipping in cents
    },
    {
      key: "Discount",
      value: 1000, // General order discount in cents
    },
  ],
});

Important Notes About Discounts

  1. Product-Specific Discounts: These should be reflected in each product’s price field. For example, if a product has a 10% discount, the price should be 90% of the listPrice.

  2. General Discounts: Discounts applied at checkout (such as coupons or payment method discounts) should be included in subItems with the key “Discount”. This discount should also be applied to the final product value. For example, if a 5% discount is applied for using a specific payment method, it should be applied to the final price of each product in the order.

  3. Commissioning: Lomadee’s commissioning algorithm considers the final value of each product (price), not the total order value after general discounts, for commission calculation. Therefore, it’s crucial that product-specific discounts are correctly reflected in each item’s price. For example, if a 5% discount is applied for using a specific payment method, it should be applied to each item’s price.

Metadata

The metadata field is an array that allows sending custom information for specific contexts. It can be used at different levels of the order structure:

  1. Order level (order.metadata)
  2. Customer level (customer.metadata)
  3. Product level (items[].metadata)
  4. Category level (items[].categories[].metadata)

Each item in the metadata array must follow the key and value structure:

metadata: [
  {
    key: "FIELD_NAME",
    value: "FIELD_VALUE",
  },
];

Usage Examples

  1. At order level:
{
  orderId: "123456",
  metadata: [
    {
      key: "SalesChannel",
      value: "Physical Store"
    },
    {
      key: "DeliveryType",
      value: "Pickup"
    }
  ]
}
  1. At customer level:
{
  customer: {
    id: "CUSTOMER_ID",
    metadata: [
      {
        key: "LoyaltyPlan",
        value: "Premium"
      },
      {
        key: "Birthday",
        value: "05/15"
      }
    ]
  }
}
  1. At product level:
{
  items: [
    {
      id: "SKU123",
      metadata: [
        {
          key: "Warranty",
          value: "12 months",
        },
        {
          key: "Manufacturer",
          value: "XYZ",
        },
      ],
    },
  ];
}
  1. At category level:
{
  categories: [
    {
      id: "CATEGORY_ID",
      name: "Electronics",
      metadata: [
        {
          key: "Type",
          value: "Department",
        },
      ],
    },
  ];
}

Important Notes

  • Keys must be strings and are case-sensitive
  • Values can be strings, numbers, or booleans
  • metadata is optional at all levels
  • Use this field to send additional information that may be useful for specific analyses or integrations

Support

For questions or issues:

  1. Contact our support team