> For the complete documentation index, see [llms.txt](https://help.littledata.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.littledata.io/integrations/shopify-to-google-analytics/source-medium-customization-payment-gateway.md).

# Source/Medium customization

Littledata enables you to set a **source and medium** to customize how orders get attributed in Google Analytics, based on a set of rules.

You can create custom rules based on:

* **Order sales channel**
* **Order payment gateway**
* **Order tags**

{% hint style="info" %}
If source/medium customization is set up, it overrides any other attribution for that order session. Rules are checked in order, and the first rule that matches is used.
{% endhint %}

#### How to use source / medium customization

All the session enrichment settings are located in the **Session enrichment** tab, in the Google Analytics 4 connection settings.

Navigate to the **Session enrichment**, add a rule, fill in the necessary information, and save.

![](https://3956158252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QhTbrMraNWciQeDvu1b%2Fuploads%2Fgit-blob-d808ba443eb41856db7d5470d760343fc01000e1%2Fsession_enrichment_embedded.png?alt=media)

{% hint style="success" %}
**Custom conditions**

If you wish to add custom channels, tags, or gateways, there will be instructions provided on how to do it once you click `Create custom channel / Create custom gateway`.
{% endhint %}

#### Sales channel

If you want to add a rule for a sales channel/app, you can pick from a list of the most popular sales channels.

Click **Add Custom Value** if you can't find the desired channel in the list, and you can enter an App ID.

For example, if you're using **Recharge** to manage recurring orders, you can set the source/medium `recharge / recurring` for all orders Recharge generates. Littledata would already have tracked recurring purchases, but previously `source` would be Not Set if the subscription was set up before Littledata was installed.

Below is a list of the most popular sales channels and Littledata's recommendations for a custom source/medium:

| Sales Channel / App           | Source (custom)  | Medium (custom)              |
| ----------------------------- | ---------------- | ---------------------------- |
| Shopify Draft                 | shopify          | draft                        |
| Recharge Subscriptions        | recharge         | recurring (or) subscriptions |
| Loop Returns and Exchanges    | loop             | returns                      |
| Tapcart                       | tapcart          | app                          |
| Zapier                        | zapier           | workflow                     |
| Refersion Affiliate marketing | refersion        | affiliates                   |
| Appstle Subscriptions         | appstle          | recurring                    |
| Facebook & Instagram          | facebook         | app                          |
| Google Shopping               | google\_shopping | app                          |
| Shop App                      | shopify          | shop\_app                    |
| TikTok                        | tiktok           | app                          |
| Gorgias                       | gorgias          | app                          |
| Matrixify                     | matrixify        | import (or) app              |
| Skio Subscriptions            | skio             | recurring (or) subscriptions |
| Loop Subscriptions            | loop             | recurring (or) subscriptions |
| Ordergroove Subscriptions     | ordergroove      | recurring (or) subscriptions |
| Bold Subscriptions            | bold             | recurring (or) subscriptions |
| Yotpo Subscriptions           | yotpo            | recurring (or) subscriptions |
| Smartrr                       | smartrr          | recurring (or) subscriptions |
| Seal Subscriptions            | seal             | recurring (or) subscriptions |
| Releasit COD Form & Upsells   | releasit         | app (or) form/upsell         |
| SB Simple Bundles & Kits      | simple           | app\_bundle                  |

{% hint style="info" %}
Some of these sources might still fall under the Unassigned default channel. However, adding custom sources for these channels will allow you to have visibility on Source/Medium data that would have otherwise been (not set).
{% endhint %}

#### Order tag

If you want to customize source/medium based on a specific order tag, you can select Order Tag as your criteria.

For example, if you have a custom tag appended to your orders, you can group those orders under a single source/medium in Google Analytics by selecting Order Tag and adding your custom value.

#### Payment gateway

Littledata offers a few standard options for **Payment gateway**: Shopify Payments, Stripe and Klarna. If your gateway isn't listed, click **Create custom channel** under the field. In the **Create custom gateway** form, enter a **Label for payment gateway** and a **Value for payment gateway**, then click **Save**.

The value must match the gateway name Shopify stores on the order. To find it:

{% stepper %}
{% step %}

#### Open an order in Shopify admin

In your Shopify admin, go to **Orders** and open an order paid with that gateway.
{% endstep %}

{% step %}

#### View the order as JSON

Add `.json` to the end of the order URL, then press **Enter**.

Your URL should look similar to this:

![Add .json to an order in Shopify admin](https://3956158252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QhTbrMraNWciQeDvu1b%2Fuploads%2Fgit-blob-bf06841a5d5a66ccc3d91ebb0a6085ba5c9d95eb%2Fimage-42-.png?alt=media)
{% endstep %}

{% step %}

#### Copy the gateway name

Scroll down, or use your browser's find tool, to locate `payment_gateway_names`.

Copy its value and paste it into the **Value for payment gateway** field in the Littledata app.

![](https://3956158252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QhTbrMraNWciQeDvu1b%2Fuploads%2Fgit-blob-33b73512862e05ec02da24aead82eeaef518248e%2Fimage-43-.png?alt=media)
{% endstep %}
{% endstepper %}

### Related articles

* [How to fix (Other) traffic in Google Analytics](https://help.littledata.io/advanced/troubleshooting/how-to-fix-other-channel-in-google-analytics)
* [Tracking Shopify payment gateways in Google Analytics](https://help.littledata.io/integrations/shopify-to-google-analytics/tracking-shopify-klarna-paypal-google-analytics)
* [How to track Shopify sales channels in GA4](https://help.littledata.io/google-analytics/acquisition/how-to-track-shopify-sales-channels-in-ga4)
