Multiple Link Types in One GS1 Digital Link

GS1 Digital Links are versatile, allowing you to encode various types of information within a single link, such as product information, promotional content, or customer service resources. To effectively support multiple link types within a single GS1 Digital Link, you need to understand how to structure the URI and configure your resolver or server to handle different types of requests.

1. Understanding GS1 Digital Link URI Structure

A GS1 Digital Link URI is built upon a base URL and contains different application identifiers (AIs) that encode specific pieces of information, such as the Global Trade Item Number (GTIN), batch number, or expiration date.

Example of a GS1 Digital Link URI:

https://example.com/01/09501101530004/10/ABC123/21/XYZ789

In this example:

  • 01 refers to the GTIN (09501101530004).
  • 10 refers to the batch or lot number (ABC123).
  • 21 refers to the serial number (XYZ789).

 

2. Including Multiple Link Types

You can support multiple link types by appending query parameters to the base GS1 Digital Link URI. These parameters can direct users to different resources depending on their needs.

Example:

https://example.com/01/09501101530004?linkType=productInfo

In this example:

  • linkType=productInfo might direct the user to a product information page.
  • linkType=support could lead to a customer support page.
  • linkType=promo could link to a promotional offe

 

3. Configuring Your Resolver or Server

To handle multiple link types, your resolver or server should interpret the linkType query parameter and redirect or serve content accordingly.

Example in Node.js (Express):

app.get('/01/:gtin', (req, res) => {
    const linkType = req.query.linkType;
    const gtin = req.params.gtin;

    switch (linkType) {
        case 'productInfo':
            res.redirect(`/products/${gtin}`);
            break;
        case 'support':
            res.redirect(`/support/${gtin}`);
            break;
        case 'promo':
            res.redirect(`/promo/${gtin}`);
            break;
        default:
            res.redirect(`/defaultPage`);
    }
});

In this example, the server checks the linkType parameter and redirects the user to the appropriate resource.

 

4. Using Default Behaviors

If the linkType parameter is not provided or recognized, your server should fall back to a default behavior. This could be redirecting users to a general product information page or displaying a selection menu where users can choose their desired action.

Example of Default Handling:

if (!linkType) {
    res.redirect(`/products/${gtin}`);
} else {
    // Handle other link types
}

 

5. Embedding Multiple Actions

In some cases, you may want to embed multiple actions or content types directly within the same GS1 Digital Link. This can be done by using additional query parameters or structured data embedded within the link.

Example with Multiple Parameters:

https://example.com/01/09501101530004?linkType=productInfo&promoCode=SUMMER21

Here, the link not only directs users to product information but also applies a promotional code.

Server Handling Example:

app.get('/01/:gtin', (req, res) => {
    const linkType = req.query.linkType;
    const promoCode = req.query.promoCode;

    if (promoCode) {
        // Apply promo code logic
    }

    switch (linkType) {
        case 'productInfo':
            res.redirect(`/products/${gtin}`);
            break;
        // other cases
    }
});

 

6. Ensuring Compatibility with GS1 Standards

While adding custom link types and parameters, ensure that your GS1 Digital Link remains compliant with GS1 standards. This means that your custom parameters should not interfere with the interpretation of GS1 AIs or the overall structure of the URI.

Best Practices:

  • Use Custom Namespaces: Prefix your custom parameters with your domain or another identifier to avoid conflicts with existing or future GS1 AIs.

Example:

https://example.com/01/09501101530004?customNamespace_linkType=productInfo

 

7. Testing and Validation

Before deploying your multi-link GS1 Digital Links, thoroughly test them across different devices and scenarios to ensure that all link types work as expected. This includes testing how your server or resolver handles different query parameters and edge cases, such as missing parameters or incorrect values.

By following these steps, you can efficiently support multiple link types within a single GS1 Digital Link, enhancing the versatility and functionality of your links while maintaining compliance with GS1 standards.