Sub topic 4
Product identifiers: GTIN, MPN, and brand
This chapter assumes you can read a product feed item (as in the earlier chapter on the data model), run a short Python script, and tell a SKU from a manufacturer's product code. It covers what each identifier is, how shopping systems use them, how to validate them, and the errors that cause the most disapprovals.
Why identifiers matter
A shopping system gets the same product from many merchants. It has to decide that your "Acme Trail Runner Jacket - Blue, M" and another store's "Acme Men's Trail Jacket (Medium, Blue)" are the same item before it can compare prices or show it in an answer. Titles are free text and differ from store to store. Identifiers are the stable keys for that match.
Three attributes do this work:
- GTIN (Global Trade Item Number) is a number that identifies a product. It is the one printed under a barcode.
- MPN (Manufacturer Part Number) is the code the manufacturer assigns to a product. It is unique only within that manufacturer.
- Brand is the name of the manufacturer or label.
Your own id (the SKU) is different. It identifies the item in your catalog only, and no other merchant uses it.
GTIN
GTIN is the umbrella name for several barcode number formats. The feed gtin attribute accepts these lengths:
| Format | Digits | Typical use |
|---|---|---|
| GTIN-8 (EAN-8) | 8 | Small packages |
| GTIN-12 (UPC-A) | 12 | North American retail |
| GTIN-13 (EAN-13) | 13 | Most of the world; also ISBN-13 for books |
| GTIN-14 | 14 | Cases and multipacks |
The last digit is a check digit. It is computed from the other digits, so a typo or a dropped digit usually makes the number invalid. Starting from the digit next to the check digit and moving left, multiply the digits alternately by 3 and 1, add them up, and the check digit is whatever brings the total to a multiple of 10. The validator at the end of this chapter uses this rule.
The GTIN in the feed item from the data model chapter, 00012345678905, is a 14-digit value. It is a UPC-A with leading zeros, which is valid. Leading zeros are significant, and they are the cause of the most common GTIN bug.
Common GTIN errors
- Lost leading zeros. A spreadsheet treats
012345678905as a number and saves12345678905. The result is 11 digits and is invalid. Format the column as text before you export. - Scientific notation. Spreadsheets can turn a 13-digit value into
1.23457E+12. Check exported CSV files. - Invented numbers. Placeholder values such as
1234567890123usually fail the check digit. Even a value that passes the check can be wrong. Never make up a GTIN. A missing one is better than a false one. - Wrong level of the product. A GTIN identifies one sellable unit. A six-pack and a single bottle have different GTINs. Do not put the single's GTIN on the six-pack.
- Reusing one GTIN across variants. Each color and size normally has its own GTIN. Sharing one across variants merges products that shoppers see as different.
- Retailer-assigned codes. Internal barcodes that you print for in-store use are not GTINs. Only numbers issued through GS1 (the standards body that licenses barcode prefixes) or by the manufacturer count.
MPN
The MPN is the part number the manufacturer uses, such as TRJ-2201-BLU. Use it when:
- The product has no GTIN. This is common for custom, handmade, vintage, and some industrial or spare-part items.
- The manufacturer sells the item in several markets and the GTIN differs by region, but the part number is the same.
Rules that prevent trouble:
- Use the manufacturer's code, not yours. If you copy your SKU into
mpn, the value matches nothing outside your store. - Keep the exact formatting, including hyphens.
TRJ-2201andTRJ2201can be treated as different values. - Do not put text in the field, such as
N/Aornone. Leave it out.
The MPN is a weaker key than a GTIN. Two manufacturers may use the same code, so the MPN is only reliable together with the brand. That is why the pair is the fallback.
Brand
Brand is required for most categories. Use the name the manufacturer uses on the product, not the name of your store. Write it the same way on every item and on the landing page (Acme, not ACME on some and Acme Inc. on others), because inconsistent spelling splits one brand into several.
Exceptions to know about:
- Books need no brand, as the ISBN identifies them. Media items generally follow the same logic.
- Your own private-label products use your own brand name. That is correct.
- Custom or unbranded goods can use the maker or the store name as brand, depending on the category rules. Check the current specification for your category.
- Do not put the store name in the brand field for products made by someone else. This is a common error and it misattributes the product.
The `identifier_exists` attribute
Some products truly have no GTIN or MPN. For these, the specification lets you set identifier_exists to no. Use it only when it is true.
<g:identifier_exists>no</g:identifier_exists>Leaving it out when identifiers are missing can raise a warning. Setting it to no on a branded product that has a GTIN hides data you could have supplied. The rule of thumb: if the manufacturer prints a barcode, find it and supply it.
How the fallback order works in practice
The decision tree in the diagram above can be summarized this way:
- A valid GTIN gives the strongest match.
- If there is no GTIN, brand plus MPN gives a usable match.
- If neither exists, the item can still be listed, but comparison and grouping with other merchants' offers will be weaker, and the system leans more on the title, description, and image.
This is why identifiers and the title chapter work together. Where identifiers are weak, the title has to carry more information.
Matching the page
The feed is not the only place an identifier appears. The JSON-LD from the product-page chapter repeats the same values:
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Acme Trail Runner Jacket - Men's, Blue, Medium",
"sku": "SKU-1001-BLU-M",
"gtin14": "00012345678905",
"mpn": "TRJ-2201-BLU-M",
"brand": { "@type": "Brand", "name": "Acme" }
}Note that schema.org has several GTIN properties: gtin8, gtin12, gtin13, gtin14, and the general gtin. Pick the one that matches the digit count, or use gtin and let the length speak. The feed value and the page value must be the same string, including leading zeros. A feed that says 00012345678905 while the page says 012345678905 can look like a mismatch even though both describe the same barcode, so choose one canonical form and use it in both places. The consistency chapter returns to this.
Validating identifiers
Checking by hand does not scale past a few dozen items. This script validates GTIN length and check digit, and flags missing brand and the common MPN problems. Save it as check_ids.py and run python check_ids.py feed.xml.
import sys
import xml.etree.ElementTree as ET
NS = {"g": "http://base.google.com/ns/1.0"}
PLACEHOLDERS = {"n/a", "na", "none", "null", "unknown", "-"}
def text(item, tag):
node = item.find("g:" + tag, NS)
return node.text.strip() if node is not None and node.text else ""
def gtin_valid(value):
if not value.isdigit() or len(value) not in (8, 12, 13, 14):
return False
body, check = value[:-1], int(value[-1])
total = sum(int(d) * (3 if i % 2 == 0 else 1) for i, d in enumerate(reversed(body)))
return (10 - total % 10) % 10 == check
def check_item(item, seen):
problems = []
item_id = text(item, "id") or "(no id)"
gtin, mpn, brand = text(item, "gtin"), text(item, "mpn"), text(item, "brand")
if gtin:
if not gtin_valid(gtin):
problems.append("invalid GTIN '" + gtin + "'")
elif gtin in seen and seen[gtin] != text(item, "item_group_id") + text(item, "color") + text(item, "size"):
problems.append("GTIN " + gtin + " reused by a different variant")
seen.setdefault(gtin, text(item, "item_group_id") + text(item, "color") + text(item, "size"))
if mpn and mpn.lower() in PLACEHOLDERS:
problems.append("placeholder MPN '" + mpn + "'")
if mpn and mpn == text(item, "id"):
problems.append("MPN equals the SKU; use the manufacturer's code")
if not brand:
problems.append("missing brand")
if not gtin and not mpn and text(item, "identifier_exists") != "no":
problems.append("no GTIN or MPN and identifier_exists is not 'no'")
return item_id, problems
def main(path):
seen = {}
count = 0
for item in ET.parse(path).getroot().iter("item"):
item_id, problems = check_item(item, seen)
for problem in problems:
count += 1
print(item_id + ": " + problem)
print("problems found: " + str(count))
return 1 if count else 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1]))The reuse check compares the variant signature (group, color, size). If two items with different signatures share a GTIN, the script reports it. This is a heuristic. Identical items that you list twice, such as one product in two language feeds, will not be flagged.
Edge cases
- Bundles and multipacks. Set
is_bundletoyesfor a bundle you assembled from several products, and usemultipackfor identical items sold together. A custom bundle usually has no GTIN of its own. Do not borrow the GTIN of one component. - Refurbished and used goods. The GTIN of the new product still applies, with
conditionset torefurbishedorused. The condition attribute separates them. - Regional barcodes. The same product may carry UPC in the US and EAN in Europe. Send the one valid for the target market.
- Barcode changes. Manufacturers sometimes reissue GTINs when packaging changes. If a supplier gives you new numbers, update both feed and markup together.
- Gray-market and resold items. A valid GTIN does not prove you are an authorized seller. Brand policies are separate from identifier checks.
Summary
Supply a valid GTIN whenever one exists, brand always, and MPN as the fallback or in addition. Treat identifiers as exact strings, validate them before each submission, and keep the page markup identical to the feed.
Exercise
A feed export from a spreadsheet contains the value 12345678905 for a product whose barcode reads 012345678905. The check digit of the real barcode is correct. What went wrong, what is the fix, and why does it matter for matching?
Show answer
The spreadsheet stored the barcode as a number and dropped the leading zero, leaving 11 digits. That length is not a valid GTIN length, so the item gets an invalid-GTIN error and loses its strongest matching key. Format the column as text (or restore the zero by padding to 12 or 14 digits) before export, and use the same form in the feed and the page's JSON-LD.
Exercise
A store sells a hand-made leather wallet with no barcode and no manufacturer part number. It is the store's own product. Which identifier attributes should the feed item contain?
Show answer
Set brand to the store's own brand name, omit gtin and mpn, and set identifier_exists to no. Do not invent a GTIN or copy the SKU into mpn. Matching will rely on the title, description, and image, so write them with extra detail.
Exercise
Why is MPN a weaker key than GTIN, and how do you use it correctly as a fallback?
Show answer
A GTIN is globally unique, but an MPN is unique only within one manufacturer, and two manufacturers can use the same code. So send it together with the correct brand, use the manufacturer's exact code (not your SKU), and keep the formatting identical everywhere.