Add the Pinterest tag to Google Tag Manager

It looks like you're viewing this from a region that Pinterest Tag isn't available in yet. See where Pinterest Tag is available to Pinterest Business accounts.

Learn more

You can connect your Google Tag Manager account with your Pinterest tag to find out how much Pinterest influences traffic to your store and sales of your products.

Add the base code

The base code allows you to gather data on events, like someone buying a product or adding a product to their shopping basket. The base code must be installed across all pages of your website. You can choose whether to install the base code on Pinterest or Google Tag Manager.

Add event codes

Event codes let you measure the impact your Pinterest ads have on certain onsite actions. They’re also necessary to launch campaigns that will automatically optimize specific events such as conversion campaigns or dynamic retargeting ads. Event codes are also necessary for accessing surfaces such as Conversion Insights.

Before you install your first event code, you have to install the base code. The base code should always be set up to fire before the event code. You can only install event codes in Google Tag Manager.

  1. Click the name of your tag below Workspace Changes to open it.
  2. Click Tag Configuration.
  3. Click the dropdown menu below Event to Fire and select the event you’d like to track on your website.
    • Depending on what you choose, optional inputs will appear. You can enter a value or click the brick icon and choose the data layer variable for the relevant event data.
    • For AddToCart, Checkout, and PageVisit event tags, you can add a dynamic variable for product_id event data for audience creation and retargeting.
      • The product_id dynamic variable doesn't need any extra syntax, it just needs to populate the ID that matches your inventory.
      • If you expect or want to send multiple product_ids at the same time, you’ll need to set up a data layer variable to use our line_items syntax. See below for the structure and an example of a line_items array.
  4. If you’d like, check the box next to Custom Parameters for audience targeting.
  5. Click Advanced Settings, then select Tag Sequencing.
  6. Check the box next to Fire a tag before <your tag> fires.
  7. Click Select Tag and choose the base tag you set up previously from the dropdown menu.
  8. Click Triggering and select the specific action or page where you'd like your event to fire.
  9. Click Save in the top-right corner.

Send in multiple product IDs

You can enter multiple product IDs at once to track traffic on all of your products.

  1. Select an event from the Event to Fire dropdown menu.
  2. Check the box next to Custom Parameters. Leave Product ID and Product Category under Line Items blank when you’re adding custom parameters. Custom Parameters box checked in Tag Configuration in Google Tag Manager
  3. Click Add Row to add a variable.
  4. Enter a name for your variable below Name, then click + below Value.
  5. Select an existing variable from the list or click + in the top-right corner to create a new variable. Google Tag Manager interface showing custom parameters saved
  6. Click Triggering to set any triggers needed for your site.
  7. Click Save.

In order for this to work, you'll also need to create a data layer variable called "items" on any page you want to set the product IDs and product categories. You can set all of them here:

  dataLayer = [{ 
    items : [
        product_id: '1414',
        product_category: 'Shoes'
        product_id: 'ABC',
        product_category: 'Toys'

Once you've added the data layer, deploy or save your website's code.

Content security policies

If you’re using a content security policy with your Google Tag Manager tag container, add these domains as exceptions to any rule preventing code from accessing scripts:

Still need help?
Contact us