Heads up! It looks as though you're seeing this article from a country where the Shopify Pinterest app isn't available yet. Learn more

You can link your Shopify account and Pinterest account to promote products on Pinterest that you’re already selling on Shopify. You can do this using the Pinterest for Shopify app or you can manually add the Pinterest tag to Shopify. If you choose to use the Pinterest for Shopify app, your domain will be claimed automatically so you do not not need to manually claim it.

If you’ve already manually added the Pinterest tag to Shopify, and you want to use the Pinterest for Shopify app instead, you’ll have to remove the tag that you added manually. Remember, you can only connect your Shopify account with one Pinterest business account at a time.

Connect your accounts to the Pinterest for Shopify app

If you have the Pinterest for Shopify app, you can install the Pinterest Tag in the app.

  1. Log in to your Shopify account
  2. Go to the Pinterest app on Shopify’s page in the Shopify App Store
  3. Review the permissions and, if you agree, click Add App
  4. Follow the instructions on the screen to finish installing the Pinterest app on Shopify
Add the Pinterest tag to Shopify manually

If you do not have the Pinterest for Shopify app, you can install the tag manually by following the below instructions.

Add the base code

The base code allows you to gather data on events, such as someone buying a product or adding a product to their shopping basket. The base code must be installed across all pages of your website.

  1. From your Shopify admin, click Online Store, then Themes.​

  2. Navigate to the theme you want to edit and click Actions, then Edit Code

  3. Click theme.liquid.

  4. Scroll until you see </head> and paste this code above it:

    <script type="text/javascript">
    !function(e){if(!window.pintrk){window.pintrk=function()
    {window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var
    n=window.pintrk;n.queue=[],n.version="3.0";var
    t=document.createElement("script");t.async=!0,t.src=e;var
    r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}}
    ("https://s.pinimg.com/ct/core.js"); 
    
    pintrk('load','YOUR_TAG_ID', { em: '{{ customer.email }}', });
    pintrk('page');
    </script> 
    <noscript> 
    <img height="1" width="1" style="display:none;" alt=""
    src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&noscript=1" /> 
    </noscript>
    
  5. Replace YOUR_TAG_ID with your own unique tag ID. To find your unique tag ID, go to Ads Manager on Pinterest. Click Ads, then Conversions and click Get started under Install Pinterest Tag. If you’ve already created a Pinterest Tag, you can click into the title to view its unique tag ID.

  6. Navigate to your conversion tracking overview and find the details section.

  7. Copy the 13-digit number below Tag ID and paste it in place of YOUR_TAG_ID in the code.

Add a Checkout event

After you install the base code, you can add different events to gather additional data. You can add the Checkout event to track when people purchase a product and complete transactions.

  1. From your Shopify admin, click Settings, then Checkout.
  2. Under Order status page scripts, paste the following tracking code into the text box. If there's already code in this box, paste your tracking code after it:
{% if first_time_accessed %}
<script type="text/javascript">
!function(e){if(!window.pintrk){window.pintrk=function()
{window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var
n=window.pintrk;n.queue=[],n.version="3.0";var
t=document.createElement("script");t.async=!0,t.src=e;var
r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}}
("https://s.pinimg.com/ct/core.js");

pintrk('load','YOUR_TAG_ID', { em: '{{ customer.email }}', }); 
pintrk('page'); 
</script> 
<noscript> 
<img height="1" width="1" style="display:none;" alt=""
src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&noscript=1" /> 
</noscript>

<script>
pintrk('track', 'checkout',{
value: {{ total_price }} / 100,
currency: '{{ currency }}',
order_quantity: 2,
event_id: '{{ event_id }}',
line_items: [
     {
       product_name: '{{ product_name_1 }}',
       product_id: '{{ product_id_1 }}',
       product_price: {{ product_price_1 }},
       product_quantity: 1
     },
     {
       product_name: '{{ product_name_2 }}',
       product_id: '{{ product_id_2 }}',
       product_price: {{ product_price_2 }},
       product_quantity: 1
     },
   ],
order_id: {{ checkout.order_id }}
});
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt=""
src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=checkout&noscript=1"/>
</noscript>
{% endif %}

Replace YOUR_TAG_ID with the unique tag ID that was generated in Ads Manager.

Add an AddToBasket event (optional)

After you install the base code, you can choose to add different events to gather additional data. You can add the AddToBasket event to track when people add products to their shopping baskets.

Note: With some Shopify themes and widgets, you will not be able to add an AddToBasket event.

  1. From your Shopify admin, click Online Store, then Themes.

  2. In the current theme you’re using, click Actions and Edit Code.

  3. Under Templates look for code files named product.liquidproduct-template.liquid, or product-form.liquid and open it. This may vary depending on the theme you have installed, but it’s most common to see ‘add to basket’ button code in the products.liquid file or equivalent.

  4. Search the file for addtocart in the code file.

  5. Place the following code within the ending caret of the <button> or <input> element

    onclick="pintrk('track', 'addtocart');"
  6. Click Save in the top right-hand corner.

Remove the manually added Pinterest tag from Shopify

If you installed the Pinterest Tag manually and want to use the Shopify app instead, you should remove any tags you installed manually before setting up the Shopify app. Make sure you remove the base code, Checkout code and AddToBasket code. You can only have one tag in an account.

Remove base code

  1. From your Shopify admin, click Online Store, and then Themes
  2. Navigate to the theme you want to edit and click Actions, then Edit Code
  3. Click theme.liquid
  4. Scroll until you see </head> and find this code:
    <script type="text/javascript">
    !function(e){if(!window.pintrk){window.pintrk=function()
    {window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var
    n=window.pintrk;n.queue=[],n.version="3.0";var
    t=document.createElement("script");t.async=!0,t.src=e;var
    r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}}
    ("https://s.pinimg.com/ct/core.js"); 
    
    pintrk('load','YOUR_TAG_ID', { em: '{{ customer.email }}', });
    pintrk('page');
    </script> 
    <noscript> 
    <img height="1" width="1" style="display:none;" alt=""
    src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&noscript=1" /> 
    </noscript>

Remove Checkout code

  1. From your Shopify admin, click Settings and then click Checkout.
  2. In the Order Status Page Scripts section, find the following tracking code in the text box. If there's more code in this box, make sure that you only remove this part of the code:
    {% if first_time_accessed %}
    <script type="text/javascript">
    !function(e){if(!window.pintrk){window.pintrk=function()
    {window.pintrk.queue.push(Array.prototype.slice.call(arguments))};var
    n=window.pintrk;n.queue=[],n.version="3.0";var
    t=document.createElement("script");t.async=!0,t.src=e;var
    r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(t,r)}}
    ("https://s.pinimg.com/ct/core.js");
    
    pintrk('load','YOUR_TAG_ID', { em: '{{ customer.email }}', }); 
    pintrk('page'); 
    </script> 
    <noscript> 
    <img height="1" width="1" style="display:none;" alt=""
    src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&noscript=1" /> 
    </noscript>
    
    <script>
    pintrk('track', 'checkout',{
    value: {{ total_price | money_without_currency }}, 
    currency: '{{ currency }}',
    order_quantity: 1,
    order_id: {{ checkout.id }}
    });
    </script>
    <noscript>
    <img height="1" width="1" style="display:none;" alt=""
    src="https://ct.pinterest.com/v3/?tid=YOUR_TAG_ID&event=checkout&noscript=1"/>
    </noscript>
    {% endif %}
    

Remove AddToBasket code

  1. From your Shopify admin, click Online Store, then Themes​.
  2. In the current theme you’re using, click Actions then Edit Code.
  3. Under Templates, look for a code file called product.liquid, product-template.liquid or product-form.liquid and open it. This may vary depending on the theme you have installed, but it’s most common to see add to basket button code in the products.liquid file or equivalent.
  4. Search the file for addtocart.
  5. Find and remove the following code. It should be at the ending caret of the <button> or <input> element onclick="pintrk('track', 'addtocart');"
  6. Click Save in the top right-hand corner.
What's next?
  • Need more help? Try these troubleshooting steps
  • Create ads with Shopify
  • Measure your reach using Shopify Analytics or Ads Manager reporting
  • End of Other articles Links
    User feedback
    Was this article helpful?

    collection_fields

    How can we make this article better?