Segment.Spec.Product (Peacemaker v3.3.5-rc.7) View Source

Builds a token for creating a Product struct, that can be attached during the Order Completed tracking event via Segment.Spec.Order.add_product/2.

You can check out the Segment docs for more information

Link to this section Summary

Functions

Creates a token that can be added to the Order struct via Segment.Spec.Order.add_product/2.

Set the brand associated with the product

Set the product category being viewed

Set the coupon code associated with a product (e.g TRIPWIRENAME)

Set the image url of the product

Set the name of the product being viewed

Set the position in the product list (ex. 3)

Set the price ($) of the product being viewed

Set the database id of the product being viewed

Set the quantity of a product

Set the sku of the product being viewed

Set the URL of the product page

Set the variant of the product (e.g. Black)

Link to this section Types

Link to this type

limelight_webhook_request()

View Source

Specs

limelight_webhook_request() :: %{
  product_category_name: String.t(),
  product_name: String.t(),
  product_id: string(),
  product_sku: String.t(),
  product_price: integer()
}

Specs

t() :: %{
  brand: String.t(),
  category: String.t(),
  coupon: String.t(),
  image_url: String.t(),
  name: String.t(),
  position: integer(),
  price: integer(),
  product_id: String.t(),
  quantity: integer(),
  sku: String.t(),
  url: String.t(),
  variant: String.t()
}

Link to this section Functions

Specs

Creates a token that can be added to the Order struct via Segment.Spec.Order.add_product/2.

NOTE: For now, this function was intended to be passed the response from PeacemakerV2.Products.get_product_attributes(product_sku, campaign_id)

Specs

set_brand(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  String.t()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the brand associated with the product

Link to this function

set_category(token, category)

View Source

Specs

set_category(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  String.t()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the product category being viewed

Link to this function

set_coupon(token, coupon)

View Source

Specs

set_coupon(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  String.t()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the coupon code associated with a product (e.g TRIPWIRENAME)

Link to this function

set_image_url(token, image_url)

View Source

Specs

set_image_url(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  String.t()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the image url of the product

Specs

set_name(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  String.t()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the name of the product being viewed

Link to this function

set_position(token, position)

View Source

Specs

set_position(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  String.t()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the position in the product list (ex. 3)

Specs

set_price(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  integer()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the price ($) of the product being viewed

Link to this function

set_product_id(token, product_id)

View Source

Specs

set_product_id(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  String.t()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the database id of the product being viewed

Link to this function

set_quantity(token, quantity)

View Source

Specs

set_quantity(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  integer()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the quantity of a product

Specs

set_sku(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  String.t()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the sku of the product being viewed

Specs

set_url(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  String.t()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the URL of the product page

Link to this function

set_variant(token, variant)

View Source

Specs

set_variant(
  %Segment.Spec.Product{
    brand: term(),
    category: term(),
    coupon: term(),
    image_url: term(),
    name: term(),
    position: term(),
    price: term(),
    product_id: term(),
    quantity: term(),
    sku: term(),
    url: term(),
    variant: term()
  },
  String.t()
) :: %Segment.Spec.Product{
  brand: term(),
  category: term(),
  coupon: term(),
  image_url: term(),
  name: term(),
  position: term(),
  price: term(),
  product_id: term(),
  quantity: term(),
  sku: term(),
  url: term(),
  variant: term()
}

Set the variant of the product (e.g. Black)