In this article, we will cover Magento 2 Pinterest tracking via GTM(Google Tag Manager). Pinterest tracking helps you improve audience targeting and create effective campaigns that will bring in more conversions. You can either hard code the tracking on your store or implement it via GTM. We are going to use GTM to implement this tracking. Please follow the guide step by step to implement the Magento 2 Pinterest tracking successfully. 

List of Events Available in Pinterest Tracking

Pinterest supports tracking for a number of events. You can find the events list here as well. We have listed these events in the table below:- 

Event  Purpose
Checkout Track people who complete transactions.
Add to Cart Track people who add items to shopping carts.
Page Visit Track people who add items to shopping carts.
Signup Track people who sign up for your product or service.
WatchVideo Track people who watch videos.
Lead Track people who show an interest in your product or service.
Search Track people who search on your website for specific products or shop locations.
ViewCategory Track people who view category pages.
Custom Track a custom event. Use this event name to track a special event that you want to include in your conversion reporting.
[User-defined-event] Add any additional events that you’ve defined for the purpose of audience targeting. Unique events are not available for conversion reporting. Keep in mind that any spaces in the custom event names passed through the tag will be removed.

Events We Will Track in Pinterest Tracking Via GTM

  • Page Visit
  • View Category
  • Add to Basket
  • Checkout
  • Search

Get Pinterest Tag ID

Please follow the steps below to get the Pinterest Tag ID and base code.

Step 1:- Go to Pinterest.com on your browser.

Step 2:- Create a business account. You won’t be charged a dime as it’s free. 

Step 3:- Once created visit Pinterest ads. Then click on Ads>Conversions

Step 4:- Start the process of Tag installation from this page. There are two parts of the setup: Base code and Event code. However we are doing it via GTM so you do not require base code. Simply implement the data layers given in the Event code and follow this guide to complete your setup. 

Step 5:- Once you go through the installation steps on this page your tag will be enabled. You can see the Pinterest Tag ID listed with the Pinterest Tag. 

Once You have the Pinterest Tag ID, create the following variable to store this ID so we can use it during our Tag creation. Please follow the steps below to create this variable:-

Step 1:- Go to your GTM container and from the left navigation menu choose Variables

Step 2:- Click on New to create a new variable. Name it “Pinterest Tag ID”. Next click on Variable Configuration.  

Step 3:- From the choose variable type menu select Constant.

Step 4:- In the Value input box enter your Pinterest Tag ID and click on Save to save your newly created variable.

Installing Pinterest Base Tag on Every Page

The base tag of Pinterest tracking is given below. It needs to be added to every page of your store.

We can also add the base tag via GTM on every page. Please follow the steps below to achieve this via GTM:-

Step 1:- Go to your GTM container and from left navigation choose Tags.

Step 2:- Click on New in the top right corner to create a new tag.

Step 3:-  Enter the Tag name as “Pinterest Base ” in the top left corner and click on Tag Configuration

Step 4:- In Choose Tag Type Menu, search for Pinterest then click on the Pinterest tag

Step 5:- In Tag Id enter the Pinterest Tag ID or you can also store this ID in a variable with type constant. Simply enter the variable name here.

Step 6:- Scroll down and select “Base Code Only (no event)” in Event to Fire.

Step 7:- Select “Yes” in Enable Enhanced Ecommerce Match? And check the Enable Metadata Enrichment box.

Step 8:- Finally in Triggering select trigger All Pages and click on save to save your newly created tag. 

Now if you publish these changes and go to your store then you will be able to see the Pinterest Base Tag firing on every page of the store. 

Testing the Tag

Pinterest Page Visit Tag Setup in GTM

The very first step for this tag setup is you should have the data layer given below implemented on every page of your store. Once done you can move on to creating necessary variables. 

Sample Datalayer:-

pintrk('track', 'pagevisit', {
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_price: 99.99,
product_brand: 'Parker'
}
]
});

Create Necessary Variables

We only need one variable to fetch the line_items for this tag. Please use the information given below to create this variable:-

Variable Name:- line_items

Variable Configuration(variable Type):- Data Layer Variable

Data Layer Variable Name:- line_items

Data Layer Version:- version 2

Screengrab:- 

Setup the Trigger

We want this tag to fire on all pages or as soon as someone visits the page. Create the trigger with the information given below:-

Trigger Name:- Pinterest GTM Ready

Trigger Type:- Custom Event

Event Name:- gtm.dom

This Trigger Fires on:- Event Equals gtm.dom

Screengrab:-

Create the Pinterest Page Visit Tag

Please follow the instructions given during the Pinterst base tag setup and use the information given below to create this tag:-

Tag Name:- Pinterest Page Visit

Tag Configuration(Tag Type):- Pinterest Tag

Tag ID:- {{Pinterest Tag ID}}

Event to Fire:- Page Visit

Custom Parameters:- Name:- line_items  Value:- {{line_items}}

Triggering:- Select the Pinterest GTM Ready trigger that we created in the previous step.

Screengrab:-

Testing the Tag

Pinterest View Category Tag Setup in GTM

Make sure to implement the data layer given below before proceeding with the tag setup. 

Sample Datalayer:-

pintrk('track', 'viewcategory', {
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_price: 99.99,
product_brand: 'Parker'
}
]
});

Create Necessary Variables

If you have implemented the data layer given above then you only need one variable i.e line_items that we created the previous tag setup. 

Setup the Trigger

We want this tag to fire when the user visits a category page. Create the trigger with the information given below:-

Trigger Name:- Pinterest View Category

Trigger Type:- Custom Event

Event Name:- viewcategory

This Trigger Fires on:- Event Equals viewcategory

Screengrab:-

Create the Pinterest View Category Tag

Please follow the instructions given during the Pinterst base tag setup and use the information given below to create this tag:-

Tag Name:- Pinterest View Category

Tag Configuration(Tag Type):- Pinterest Tag

Tag ID:- {{Pinterest Tag ID}}

Event to Fire:- View Category

Custom Parameters:- Name:- line_items  Value:- {{line_items}}

Triggering:- Select the Pinterest View Category trigger that we created in the previous step.

Screengrab:-

Testing the Tag

Pinterest Add to Basket Tag Setup in GTM

Same as above you first want to implement the data layer given below before proceeding with the setup.

Sample Datalayer:-

pintrk('track', 'addtocart', {
value: 100,
order_quantity: 1,
currency: 'USD',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_price: 99.99,
product_brand: 'Parker'
}
]
});

Create Necessary Variables

We only need the following variables:-

1. Line_items

2. addedPPrice

Variable Name:- addedPPrice

Variable Configuration(variable Type):- Data Layer Variable

Data Layer Variable Name:- value

Data Layer Version:- version 2

Screengrab:- 

3. currencyCode

Variable Name:- currencyCode

Variable Configuration(variable Type):- Data Layer Variable

Data Layer Variable Name:- currency

Data Layer Version:- version 2

Screengrab:- 

4. Pinterest Basket Order Quantity

Variable Name:- Pinterest Basket Order Quantity

Variable Configuration(variable Type):- Data Layer Variable

Data Layer Variable Name:- order_quantity

Data Layer Version:- version 2

Screengrab:- 

5. addedPID

Variable Name:- addedPID

Variable Configuration(variable Type):- Data Layer Variable

Data Layer Variable Name:- Id

Data Layer Version:- version 2

Screengrab:- 

Setup the Trigger

We want this tag to fire when a product is added to the cart. Create the trigger with the information given below:-

Trigger Name:- Pinterest Add to Basket

Trigger Type:- Custom Event

Event Name:- addtoCart

This Trigger Fires on:- Event Equals addtoCart

Screengrab:-

Create the Pinterest Add to Basket Tag

Please follow the instructions given during the Pinterst base tag setup and use the information given below to create this tag:-

Tag Name:- Pinterest Add to Basket

Tag Configuration(Tag Type):- Pinterest Tag

Tag ID:- {{Pinterest Tag ID}}

Event to Fire:- Add to Cart

Order Value:- {{addedPPrice}}

Currency:- {{currencyCode}}

Order Quantity:- {{Pinterest basket order quantity}}

Order Id:- {{addedPID}}

Custom Parameters:- Name:- line_items  Value:- {{line_items}}

Triggering:- Select the Pinterest Add to Basket trigger that we created in the previous step.

Screengrab:-

Testing the Tag

Pinterest Checkout Tag Setup in GTM

Please make sure to implement the data layer given below before proceeding with the tag setup:-

Sample Datalayer:-

pintrk('track', 'checkout', {
value: 100,
order_quantity: 1,
currency: 'USD',
line_items: [
{
product_name: 'Parker Boots',
product_id: '1414',
product_category: 'Shoes',
product_price: 99.99,
product_quantity: 1
}
]
});

Create Necessary Variables

We need the following variables for this tag setup:-

1. Line_items

2. Order Value

Variable Name:- Order Value

Variable Configuration(variable Type):- Data Layer Variable

Data Layer Variable Name:- value

Data Layer Version:- version 2

Screengrab:- 

3. Order Currency Code

Variable Name:- Order Currency Code

Variable Configuration(variable Type):- Data Layer Variable

Data Layer Variable Name:- currency

Data Layer Version:- version 2

Screengrab:- 

4. Pinterest Checkout Order Quantity

Variable Name:- Pinterest Checkout Order Quantity

Variable Configuration(variable Type):- Data Layer Variable

Data Layer Variable Name:- order_quantity

Data Layer Version:- version 2

Screengrab:- 

5. Order ID

Variable Name:- Order ID

Variable Configuration(variable Type):- Data Layer Variable

Data Layer Variable Name:- Id

Data Layer Version:- version 2

Screengrab:- 

Setup the Trigger

We want this tag to fire when someone purchases a product. Create the trigger with the information given below:-

Trigger Name:- Pinterest Purchase

Trigger Type:- Custom Event

Event Name:- checkout

This Trigger Fires on:- Event Equals checkout

Screengrab:-

Create the Checkout Tag

Please follow the instructions given during the Pinterst base tag setup and use the information given below to create this tag:-

Tag Name:- Pinterest Checkout

Tag Configuration(Tag Type):- Pinterest Tag

Tag ID:- {{Pinterest Tag ID}}

Event to Fire:- checkout

Order Value:- {{Order Value}}

Currency:- {{Order Currency Code}}

Order Quantity:- {{Pinterest checkout order quantity}}

Order Id:- {{Order Id}}

Custom Parameters:- Name:- line_items  Value:- {{line_items}}

Triggering:- Select the Pinterest Purchase trigger that we created in the previous step.

Screengrab:-

Testing the Tag

Pinterest Search Tag Setup in GTM

Implement the below-given data layer and then continue with the setup:-

Sample Datalayer:-

pintrk('track', 'search', {
search_query: 'boots'
});

Create Necessary Variables

We need one variable to fetch the search query for this tag setup:-

Variable Name:- Query – Url

Variable Configuration(variable Type):- URL

Component Type:- query

Query key:- q

Screengrab:- 

Setup the Trigger

We want this tag to fire when someone searches something in your store. Create the trigger with the information given below:-

Trigger Name:- Pinterest Search Page

Trigger Type:- Page View

This Trigger Fires on:- Page URL contains result

Screengrab:-

Create the Pinterest Search Tag

Please follow the instructions given during the Pinterst base tag setup and use the information given below to create this tag:-

Tag Name:- Pinterest Search

Tag Configuration(Tag Type):- Pinterest Tag

Tag ID:- {{Pinterest Tag ID}}

Event to Fire:- search

Search Query:- {{Query-Url}}

Triggering:- Select the Pinterest Search Page trigger that we created in the previous step.

Screengrab:-

Testing the Tag

Conclusion

We hope that by the end of this article you have managed to successfully set up the Magento 2 Pinterest tracking via GTM. If you do not want to go through the hassle of the entire setup then you can check out our Magento 2 GTM pro extension that includes a JSON file of the entire setup above. So as soon as you import this file in GTM you will have a running Pinterest tracking setup. It also includes several other trackings such as Google Analytics 4, Enhanced Ecommerce Universal Analytics, Facebook Pixel Tracking, Google Adwords Dynamic Remarketing, Google Ads conversion tracking, etc. Please feel free to ask your doubts in the comments below.

Similar Posts