---
schema_version: "1"
id: 3993005ffc5bea8e0eee870b037fa2448bdd121acf66477f83ebfb8e57a6ae37
title: Source Code Example for B2C Commerce
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/cc/264-0-0/b2c_source_codes_example.md
canonical_url: https://help.salesforce.com/s/articleView?id=cc.b2c_source_codes_example.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 7d2e3dca7aa7ecdcb7c2dd20650a3db189771ffbb6f76e1893c93f263ab724e2
description: A source code is typically provided by the customer via a redirect link found on an affiliate website.
products:
  - Commerce
  - B2C Commerce
release: "264"
---
# Source Code Example for B2C Commerce

A source code is typically provided by the customer via a redirect link found on an affiliate website.

For example, a customer clicks your advertisement on a general retail site, containing a source code; and they’re redirected to a specific page on your site, such as Amazon.com. They’re redirected to your site you are on a general retail site. Using source codes, direct customers to specialized landing pages, featured product detail pages, category lists, and URLs.

The following example explains how to use and test source codes with the SiteGenesis application.

1. Create a promotion.
    1. Click App Launcher ![App Launcher](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/cc/b2c_merchandiser_administrator/images/appLauncher.png), and then select **site** | **Merchant Tools** | **Online Marketing** | **Promotion**.
    2. Click **New**.
    3. Select a language and click **Apply**.
    4. Enter the ID (sourcecode), name (Source code test), enable it, set to searchable, and set exclusivity to **NO (can be combined with any promotion)**.
    5. Click **Apply**.
    6. Scroll down and specify the promotion class: **Product**: **Without Qualifying Products**.
    7. Specify Discount: 50 > Amount Off.
    8. Discounted Products: ID=008884303989.
    9. Click **Save**.
    10. Click **Apply**.
2. Create a campaign and assign the promotion to it.
    1. Click App Launcher ![App Launcher](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/cc/b2c_merchandiser_administrator/images/appLauncher.png), and then select **site** | **Merchant Tools** | **Online Marketing** | **Campaigns**.
    2. Click **New** and create a campaign (Affiliates).
    3. Enable the campaign.
    4. Click **Add Experience** and Add Promotion.
    5. Locate and select **sourcecode**.
    6. Click **Apply**.
3. Configure a source code group.
    1. Click App Launcher ![App Launcher](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/cc/b2c_merchandiser_administrator/images/appLauncher.png), and then select **site** | **Merchant Tools** | **Online Marketing** | **Source Code Groups**.
    2. Click **New**.
    3. Enter ID (scgroup2) click **Apply**.
    4. Click the **Code** tab, enter a code in the Source Code specification: SCT\[1..10\].
    5. Click the **Redirects** tab. Under Active, select **Product** and enter the discounted product ID (008884303989)
    6. Click **Apply**.
4. Specify the distributor.
    1. Click App Launcher ![App Launcher](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/cc/b2c_merchandiser_administrator/images/appLauncher.png), and then select **site** | **Merchant Tools** | **SEO** | **Dynamic Mapping**. Create a distributor name.
    2. Enter the following: /TANDIST/\* p,,,SourceCodeRedirect-Start,,src,{0}. This entry is the distributor.
    3. Click **Save**.
5. Change the URL in the SiteGenesis application so that you can see how the source code works.
    1. Open the SiteGenesis application in your browser.
    2. Click App Launcher ![App Launcher](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/cc/b2c_merchandiser_administrator/images/appLauncher.png), and then navigate to **Womens** | **Tops**.
        
        The resulting URL looks like this:
        
        ```
        http://xx-dw.demandware.net/s/SiteGenesis/search?cgid=womens-clothing-tops&lang=en_US
        ```
    3. In the URL, remove everything after SiteGenesis.
        
        The resulting URL looks like this:
        
        ```
        http://xx-dw.demandware.net/s/SiteGenesis/
        ```
    4. Add the distributor's name and the source code to the URL.
        
        The resulting URL looks like this:
        
        ```
        http://xx-dw.demandware.net/s/SiteGenesis/SCTST/SCT2
        ```
    5. Click **Enter**.
        
        You’re redirected to the following page:
        
        ```
        http://xx-dw.demandware.net/on/demandware.store/Sites-SiteGenesis-Site/en_US/Link-Product?pid=008884303989
        ```