> For the complete documentation index, see [llms.txt](https://docs.didomi.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.didomi.io/integrations/content-management-system-cms/shopify-beta/migrate-shopify-integration.md).

# Migrate Shopify integration

Prior to the launch of the native Didomi/Shopify integration, Didomi provided two scripts that could be manually added to your organization's Shopify store.&#x20;

<table data-header-hidden><thead><tr><th width="120"></th><th></th></tr></thead><tbody><tr><td>Script 1</td><td>Propagated consent from Shopify consent categories</td></tr><tr><td>Script 2</td><td>Checkout handling</td></tr></tbody></table>

In this article, we will cover how to remove these previous scripts so that your organization can migrate to the native Didomi/Shopify integration.

* [Remove script 1](#remove-script-1)
* [Remove script 2](#remove-script-2)
* [Configure the native Didomi/Shopify integration](/integrations/content-management-system-cms/shopify-beta.md)

{% hint style="info" %}
Organizations that have previously implemented script 1 and script 2 should remove those scripts before continuing with the configuration of the Didomi/Shopify native integration.
{% endhint %}

***

### Remove script 1

Script 1 enabled your organization to propagate consent values for vendors configured in the Didomi CMP from the four [Shopify consent categories](/integrations/content-management-system-cms/shopify-beta.md#shopify-consent-categories): Analytics, Marketing, Preferences, and Sale of Data. The native Didomi/Shopify integration will handle this propagation once implemented, so this script should be removed from your Shopify store's theme code.

Navigate to the admin view of your Shopify store and click **Online Store** on the left-hand panel.

Click the ellipsis inline with the active theme for your online store and select **Edit code** from the drop-down menu.

<figure><img src="/files/92WktTwvA1RNZsISe0ts" alt="" width="563"><figcaption></figcaption></figure>

In the Shopify store theme code editor, expand the **layout** menu and select the **theme.liquid** file.

<figure><img src="/files/Pl7OcNKxpcZBUY6AuYLX" alt="" width="563"><figcaption></figcaption></figure>

Delete the Didomi SDK script from the `<head>` tag in the file. Below is an example of the Didomi SDK script.

<details>

<summary>Didomi SDK script example</summary>

{% code overflow="wrap" %}

```javascript
<script type="text/javascript">(function(){function i(e){if(!window.frames[e]){if(document.body&&document.body.firstChild){var t=document.body;var n=document.createElement("iframe");n.style.display="none";n.name=e;n.title=e;t.insertBefore(n,t.firstChild)}else{setTimeout(function(){i(e)},5)}}}function e(n,o,r,f,s){function e(e,t,n,i){if(typeof n!=="function"){return}if(!window[o]){window[o]=[]}var a=false;if(s){a=s(e,i,n)}if(!a){window[o].push({command:e,version:t,callback:n,parameter:i})}}e.stub=true;e.stubVersion=2;function t(i){if(!window[n]||window[n].stub!==true){return}if(!i.data){return}var a=typeof i.data==="string";var e;try{e=a?JSON.parse(i.data):i.data}catch(t){return}if(e[r]){var o=e[r];windown{var n={};n[f]={returnValue:e,success:t,callId:o.callId};if(i.source){i.source.postMessage(a?JSON.stringify(n):n,"*")}},o.parameter)}}if(typeof window[n]!=="function"){window[n]=e;if(window.addEventListener){window.addEventListener("message",t,false)}else{window.attachEvent("onmessage",t)}}}e("__tcfapi","__tcfapiBuffer","__tcfapiCall","__tcfapiReturn");i("__tcfapiLocator")})();</script><script type="text/javascript">(function(){(function(e,i,o){var n=document.createElement("link");n.rel="preconnect";n.as="script";var t=document.createElement("link");t.rel="dns-prefetch";t.as="script";var r=document.createElement("script");r.id="spcloader";r.type="text/javascript";r["async"]=true;r.charset="utf-8";window.didomiConfig=window.didomiConfig||{};window.didomiConfig.sdkPath=window.didomiConfig.sdkPath||o||"https://sdk.privacy-center.org/";const d=window.didomiConfig.sdkPath;var a=d+e+"/loader.js?target_type=notice&target="+i;if(window.didomiConfig&&window.didomiConfig.user){var c=window.didomiConfig.user;var s=c.country;var f=c.region;if(s){a=a+"&country="+s;if(f){a=a+"&region="+f}}}n.href=d;t.href=d;r.src=a;var m=document.getElementsByTagName("script")[0];m.parentNode.insertBefore(n,m);m.parentNode.insertBefore(t,m);m.parentNode.insertBefore(r,m)})("myAPIKey","NoticeID")})();</script>
```

{% endcode %}

</details>

Next, locate the following line in the **theme.liquid** file and delete it to stop using the script in your Shopify store theme:

{% code overflow="wrap" %}

```liquid
{% render 'didomi-shopify-integration' %}
```

{% endcode %}

Save the changes made to the file when finished.

Finally, expand the **snippets** menu and locate the **didomi-shopify-integration.liquid** file.

<figure><img src="/files/aZlQSRyRncwagGujXnij" alt="" width="563"><figcaption></figcaption></figure>

Right-click on the file and select **Delete Permanently** from the subsequent drop-down menu.

<figure><img src="/files/WpBE6J2R5g0PiMHSPDiw" alt="" width="563"><figcaption></figcaption></figure>

Confirm the decision to delete the didomi-shopify-integration.liquid file in the subsequent modal and click **Delete**.

<figure><img src="/files/VAbCIxoWW1LETb5fYr4F" alt="" width="375"><figcaption></figcaption></figure>

### Remove script 2

Script 2 enabled your organization to integrate the Didomi CMP into the Shopify checkout process by using a custom pixel within the Shopify store.&#x20;

In order to remove this script, navigate to the admin view of your Shopify store and click **Settings** on the left-hand panel.

<figure><img src="/files/4KwWL6MnAclJxV0DGjom" alt="" width="563"><figcaption></figcaption></figure>

Click **Customer events** on the left-hand panel of the subsequent page.

<figure><img src="/files/MuWJrAD0XWZUUnnIr7eT" alt="" width="563"><figcaption></figcaption></figure>

Select the pixel where the Didomi script is added from the list.

<figure><img src="/files/FMaJXwMr4dyGg8vLic3l" alt="" width="563"><figcaption></figcaption></figure>

Locate the script in the code editor for the pixel and remove it from the code. Below is an example.

<details>

<summary>Script 2 example</summary>

{% code overflow="wrap" %}

```javascript
window.dataLayer = window.dataLayer || [];
function gtag() {
  dataLayer.push(arguments);
}

function areVendorsEnabledInToken() {
  const cookieName = "didomi_token";
  const vendorsToCheck = ["google", "c:googleana-4TXnJigR"];

  // Get the value of a specific cookie
  const getCookieValue = (cookieName) => {
    const cookies = document.cookie.split("; ");
    const cookie = cookies.find((c) => c.startsWith(`${cookieName}=`));
    return cookie ? decodeURIComponent(cookie.split("=")[1]) : null;
  };

  // Decode Base64 and parse JSON
  const decodeBase64Cookie = (base64String) => {
    const decodedString = atob(base64String);
    return JSON.parse(decodedString);
  };

  // Check which vendors are enabled
  const checkVendors = (cookieData, vendorsToCheck) => {
    const result = {};
    vendorsToCheck.forEach((vendor) => {
      result[vendor] =
        cookieData &&
        cookieData.vendors &&
        cookieData.vendors.enabled &&
        cookieData.vendors.enabled.includes(vendor);
    });
    return result;
  };

  // Retrieve Didomi token from cookies or localStorage
  const didomiToken =
    getCookieValue(cookieName) || localStorage.getItem(cookieName);

  if (!didomiToken) {
    console.error(`Cookie ${cookieName} not found.`);
    return null;
  }

  return checkVendors(decodeBase64Cookie(didomiToken), vendorsToCheck);
}

if (
  window.location.href.includes("/checkout/") ||
  window.location.href.includes("/checkouts/")
) {
  gtag("consent", "default", {
    ad_storage: "denied",
    analytics_storage: "denied",
    functionality_storage: "denied",
    personalization_storage: "denied",
    security_storage: "granted",
    ad_user_data: "denied",
    ad_personalization: "denied",
    wait_for_update: 500,
  });

  analytics.subscribe("page_viewed", () => {
    const { google, "c:googleana-4TXnJigR": googleAnalytics } =
      areVendorsEnabledInToken();
    gtag("consent", "update", {
      ad_storage: google ? "granted" : "denied",
      analytics_storage: googleAnalytics ? "granted" : "denied",
      functionality_storage: google ? "granted" : "denied",
      personalization_storage: google ? "granted" : "denied",
      security_storage: "granted",
      ad_user_data: google ? "granted" : "denied",
      ad_personalization: google ? "granted" : "denied",
      wait_for_update: 500,
    });
  });
}
```

{% endcode %}

</details>

Click **Save** when finished.

<figure><img src="/files/GexLFrn5Diw9GEjwBE6r" alt="" width="563"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.didomi.io/integrations/content-management-system-cms/shopify-beta/migrate-shopify-integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
