Friday, April 26, 2024
No menu items!
HomeData Analytics and VisualizationImplement Pinterest Tag with Google Tag Manager

Implement Pinterest Tag with Google Tag Manager

Updated: January 1st, 2022

When it comes to selecting tracking pixels, Pinterest (in most cases) will probably not reach the top 3. However, if you’re working in a business that’s related to fashion, style, Pinterest Tag might definitely be an option.

I recently had my first serious encounter with the Pinterest Tag (because usually, people ask me to help with GA or Facebook Pixel), and … that was something. While it wasn’t terrible, it wasn’t great and streamlined either.

Mainly, due to lacking documentation and other resources available online.

After playing around with it, here are my findings on how to implement Pinterest Tag with Google Tag Manager.

Note: if you notice any mistake, please let me know and I’ll fix it asap. There still might be some parts that I just missed.


Table of contents

+ Show table of contents +

#1. Introduction
#2. Pageview tracking
#3. Test the tag
#4. Tracking other events
#4.1. Trigger and Variable
#4.2. Create the Tag
#4.3. Test the tag

#5. Event parameters (standard and custom)
Page visit event
Add To Cart event
Checkout event
Signup
Watch video
Lead
Search
View category
Custom parameters

#6. Custom events
#6.1. “Custom” event
#6.2. User-defined event

#7. Creating audiences
#8. User Privacy Preferences
#9. Reuse GA Enhanced Ecommerce data in Pinterest Pixel
Implement Pinterest Pixel with Google Tag Manager: Final Words

 

#1. Introduction

If you prefer video content, here’s a tutorial from my Youtube channel on how to install Pinterest Tag with Google Tag Manager.

I will not dive too deep into the benefits and importance of tracking pixels to marketing campaigns. If you have at least a decent amount of experience with any other pixel (e.g. Facebook Pixel), you’ll already know most of the story:

ability to report conversions
ability to build audiences and more precise targeting, etc.

And even though the industry is rapidly changing and browsers are becoming stricter when it comes to tracking, you might still find this guide useful until the cookiegeddon reaches its final form.

Now, back to the main topic, Pinterest Tag. One of the possible reasons why it’s not THAT popular is because the list of supported countries is not as big as in other major players (FB or Google).

To get started, you will need to signup to https://ads.pinterest.com/ and go to Ads > Conversions. Then you will be asked to install the Pinterest Tag. Since this blog is mainly dedicated to Google Tag Manager, we’ll most definitely choose the “Add code to website” option. Click Add Code button.

Then you’ll see the Pinterest Tag code that you should add to your website. But since we are working with GTM, all you need to do is to copy the pixel ID (which is located in the top right corner). We’ll use it very soon.

 

#2. Pageview tracking

First, you should start with pageview tracking. This means that on every page, you should activate the basic Pinterest Tag code. To do that, go to Tags (in GTM interface) > New > Pinterest Tag and enter the following settings.

The trigger of this tag is “All pages”

On some pages of the Pinterest TAg documentation, you are told to first create the Base pixel tag (where the Event to Fire field is set to Base code only (no event)) but after doing various tests, it looks like this is absolutely unnecessary if you are using the Pinterest tag template in GTM. Events (configured with that template) work just fine even without the base code tag.

That’s why I created just the Page Visit tag.

However, if you want to enable things like “Enable metadata enrichment” to all your Pinterest Tags, you then might want to create a Base pixel tag and fire it first on a page (with GTM Tag Sequencing).

Speaking of other fields in the tag, you can enter the email address of the visitor/user to enable the Enhanced Match feature. You can either insert a hashed email into the field or you can insert the regular email address and then the pixel will hash it for you. The hashed value is then sent to Pinterest servers.

Where can you get the email address from? One of the possible ways could be to ask a developer to push the email to the Data Layer.

Save the tag.

 

#3. Test the tag

Now, it’s time to check if page view is tracked properly. Install a Chrome extension called Pinterest Tag Helper. After you do that, refresh the GTM preview mode and then refresh the page where you want to install the Pinterest Tag.

If the pageview was sent properly, the color of the extension’s icon will change. Click it.

Then, you will see what kind of information was sent to Pinterest. You can click that event (Page visit) to see what URL was tracked.

Finally, you’ll also need to check if the data was properly received by Pinterest. To do that, go to ads.pinterest.com > Ads > Conversions > Test Events. Enter the URL of the page where you want to implement the pixel. Click Launch.

After this has happened, you should start seeing the page visit being received. You should later repeat the same process with every interaction that you want to send to Pinterest.

 

#4. Tracking other events

If you prefer video content, take a look at this tutorial first:

Page visit is not the only interaction that is supported by Pinterest Tag. There is a longer list available here. As of the moment of writing this blog post, the other supported events are:

Most of them are supported in both audience creation and conversion reporting. Audience creation means that you can create an audience based on interactions people have made (for example, watched a certain video or subscribed to a newsletter, or something else).

Speaking of custom events, I have a separate chapter in this blog post on that. Now, let’s go back to the standard events. I’ll show you one example step by step. But if you want to go all-in on this one, you’ll need to learn about the capabilities of Google Tag Manager in general (p.s. that’s what my courses are all about).

Let’s say that we want to send events when a visitor subscribes to our newsletter. There are various methods on how to track forms but let’s imagine that this time, we are cooperating with a developer and he/she pushes form submission data to the Data Layer. Here’s an example:

<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
‘event’: ’email_optin’,
‘formType’: ‘newsletter’
});
</script>

To send this data to Pinterest, we will need to:

Create a Custom Event trigger called email_optin
Create a Data Layer Variable called formType
Create a Pinterest Tag

 

#4.1. Trigger and Variable

In Google Tag Manager, go to Triggers > New > Custom Event and enter the following settings:

It’s important that the event name (email_optin) is entered exactly like that. Save the trigger.

Then go to Variables > User-defined variables > New > Data Layer Variable and enter the following settings:

“Data Layer Variable Name” field is case-sensitive. Save the Variable. Why did we do this? Because we want to send the value of formType to Pinterest Tag.

One more thing. Since we are going to create another tag for this event, manually entering the Pixel ID in the tags is not optimal. Instead, we can create a variable (type: constant) and enter the Pixel ID there. Go to Variables > User-defined variables > New > Constant and enter your Pixel ID there.

Save the variable. We’ll use it in the next step.

 

#4.2. Create the Tag

Go to Tags > New > Pinterest Tag and enter the following settings:

In the Lead type field, I inserted the Data Layer variable that returns the information about the form type (that a visitor submitted).

Take a closer look at the Tag ID field. Instead of entering the Pixel ID, I entered the previously created constant variable surrounded by {{ }}.

In the triggering section, I have assigned the previously created Custom Event trigger. Save the tag.

Speaking of the constant variable, you should go back to the Page visit Pinterest tag and replace your Pixel ID with the constant variable.

Why? Because from now on, all Pinterest Tags will be using the same variable (containing the ID). If at some point in the future, we decide to switch the ID, we will need to do that only once – in the Constant Variable. Then all Pinterest tags will automatically inherit that ID.

 

#4.3. Test the tag

After you have created 2 variables, one tag, and one trigger, refresh the GTM preview mode and check:

Pinterest Tag Helper
Pinterest Test events report

See chapter #3 for more information.

 

#5. Event parameters (standard and custom)

Together with events, you can send parameters. Some parameters have already predefined fields in the tag template while others can be added as custom parameters.

In general, the data model of Pinterest Tag is quite flexible and will accept pretty much anything that you pass.

But first, let’s take a look at those that are mentioned in the official documentation.

 

Page visit event

The tag template offers two additional pre-defined fields:

Product ID
Product category

Both fields are useful if you are tracking product pageviews (when a visitor lands on a page of a certain product). If you want to pass multiple products with the same pageview, you will need to click the “Custom parameters” checkbox and enter the key line_items where product data must be formatted in the following way:

[
{
product_name: ‘Parker Boots’,
product_id: ‘1414’,
product_price: 5.00,
product_quantity: 1
},
{
product_name: ‘Parker Sandals’,
product_id: ‘ABC’,
product_price: 5.00,
product_quantity: 1
}
]

It must be an array where every product is an object. And every object must contain parameters that are named exactly like in the example above. Here’s what a Pinterest Tag could look like:

How can you get that line_items data as a GTM variable? You could ask a developer to push the product data to the Data Layer in the following format (where line_items is an array):

And then create a Data Layer Variable with the parameter name line_items:

Speaking of line items, these are the parameters that are currently supported (I honestly haven’t tried to add custom parameters there but I’m pretty sure they would work too):

product_name
product_id
product_category
product_variant_id
product_variant
product_price
product_quantity
product_brand

Not sure about the format of these parameters? Refer to the documentation.

Not sure which parameters are the most important to the Pixel? Try to send the event to Pinterest and see what kind of warnings or errors are you seeing in the Pinterest Tag Helper and, if possible, try to fix them.

 

Add To Cart event

Add to Cart event in the Pinterest tag template asks you a bunch of additional info:

Order Value
Currency
Order quantity
Order ID

If you want to pass just one product, you can fill in these two fields:

Product ID
Product Category

If more products were added at the same time to the cart, add a custom parameter line_items (just like I have explained in the Page visits tracking section).

If you are wondering where can you get that data from (in order to use it in the tag), in most cases, you might need to cooperate with a developer and ask him/her to pass this data to the Data Layer, then take it from there with Data Layer Variables and insert those variables in the Pinterest Tag.

 

Checkout event

If you have worked more with the Enhanced Ecommerce in Google Analytics than with Pinterest Tag, you might find the word “Checkout” a bit misleading. In GA Enhanced Ecommerce, Checkout is when the visitor starts entering the billing information, shipping information, etc.

The actual transaction is not part of the transactions.

But in Pinterest Tag, checkout is the actual payment. When a visitor/user makes a purchase, a Checkout event must be sent to Pinterest.

When you choose “Checkout” event in the Pinterest tag template, you’ll need to enter the following fields:

Order value
Currency
Order quantity (how many items were purchased). If there were 3 products X and 2 products Y, then the value should be 5
Order ID
If it’s possible to always purchase only one product, you could fill in two fields:
Product ID
Product Category

But if the number of products may differ, add a custom parameter line_items instead and format it in the following way:
[
{
product_name: ‘Parker Boots’,
product_id: ‘1414’,
product_price: 5.00,
product_quantity: 1
},
{
product_name: ‘Parker Sandals’,
product_id: ‘ABC’,
product_price: 5.00,
product_quantity: 1
}
]

To learn more about the line_items parameter, read the chapter about the Page visit tracking in this article.

Speaking of all product parameters, you can add the following:

product_name
product_id
product_category
product_variant_id
product_variant
product_price
product_quantity
product_brand

When it comes to parameters and format of their values, always refer to the official documentation. They have some examples there.

 

Signup

If visitors can signup/register, you should send a signup event. When you select this event in the Pinterest tag template, you can also enter the field called Lead Type.

This is useful if there are multiple signup forms where people can create an account. If you want to track when someone becomes a lead (e.g. opts-in to your newsletter or downloads an ebook, I’d use another event type, Lead). More about it — later.

 

Watch video

If you have some videos on your website, you can track them with this event. For example, if a visitor watches at least 50% of the video, you can send a “Watch video” event to Pinterest.

For that, you’d need to create a trigger that fires the tag specifically when the 50% mark is reached. Read this blog post to learn more about video tracking.

Together with this event, you can send a custom parameter called video_title in order to identify which exact video was watched. This parameter is also mentioned in the documentation.

As I have mentioned, Pinterest Tag’s data model is quite flexible. If you want to send more custom parameters about the video, you can do that (at least based on what I’ve seen). Those parameters can be used to build audiences.

The name of those custom parameters is up to you. But looking at the naming convention that is displayed in Pinterest’s documentation, I’d recommend going with all-lowercase + underscore, for example, video_id, video_author, etc.

 

Lead

When someone becomes a lead (e.g. downloads an e-book, subscribes to a newsletter), use this event type. When you select it in the Pinterest Tag template, you can also fill in a field called Lead Type.

This can be either a type of a form that a visitor submitted (e.g. “newsletter”, “landing page”, “purchase form”, etc.) or the name of the actual form (e.g. “newsletter popup”, “ebook about weight loss”, etc.)

Also, you can pass some ad-hoc parameters that are not described in the documentation. For example, you can use the Lead type field to send info like “newsletter”, “landing page”, and then include another parameter form_name that contains the name of the lead magnet.

Keep in mind that I just came up with the form_name name. You can use any other name if you want.

 

Search

If your website offers search functionality, you can definitely track that and send the search term to the pixel. If you don’t know where to get the search query from (as a GTM variable), read this guide.

When you have the variable ready, insert it in the “Search query” field (after the “Search” event is selected in the tag).

 

View category

When a visitor views a page/list of a category (e.g. product category or article category), you can send this to the pixel. I haven’t used this much, therefore, cannot provide a lot of insights/tips.

After looking at Pinterest’s documentation, I could not find any parameter specifically for this event (note that product_category parameter is built for the line_items array).

My guess is that either it’s enough to just send the View Category event itself or maybe you can also pass the line_items array. But after I passed just a plain View Category event without any custom data, Pinterest Tag Helper showed no error.

 

Custom parameters

Based on various experiments, it looks like Pinterest Tag’s data model is quite flexible and will accept even those parameters that are not described in the documentation.

Want to send some very unique parameter video_length with Watch Video event? You are free to do so. This data will be later available while building audiences for retargeting.

 

#6. Custom events

What if you want to track interactions that are not in the list of standard events? For example, scrolling, link clicks, time spent on a page, etc.?

I have some good and some bad news. You can send them to Pinterest too, however, be aware of the limitations:

If you use Event to fire type “Custom”, you can use that in conversion reporting, however, you cannot specify what kind of custom event it is. At least that’s what I saw (if I’m wrong, please let me know).
In your conversion reports, you will be able to see how many “Custom” events were made but you cannot see whether that event is scrolling, clicking, time, or something else. In fact, when you select “Custom” type, there is no field that allows you to specify what kind of event that was. Not very useful. But you could try to overcome this with some custom parameter, say, custom_event_name , and send it together with custom events. I haven’t tried this, therefore, don’t know how will this affect your conversion reports. Do it at your own risk.

If you want to send a custom event with some custom name, you can send a user-defined event.
However, you cannot use the Pinterest tag template in GTM (because as far as I can see, there is no such option there).
You’ll need to use the Custom HTML tag.
And even if you do that, you will not be able to see such custom events in your conversion reports. Additionally, you can have only one user-defined per pixel (which is total bonkers). Every new user-defined event name rewrote the previous event’s name. #not_very_helpful.

So, let’s take a look at both options on how to track custom events.

 

#6.1. “Custom” event

I don’t find this particular event type very useful. Sure, you can send a custom event but what if you have 10 different custom events? All of them in the conversion reports will be displayed as that very same “Custom” event. But if you have just one custom event on a website (sounds a little weird), then you might want to use it.

In that case, you can create a tag with the following settings:

I did not display the triggering section because it’s completely up to you. GTM is a flexible tool that allows you to track things like clicks, scrolling, time on page, etc.

At this point, you might be thinking: what if I send some custom parameter (say, “custom_event_name”) together with the custom event? Sure, you can do that. Just keep in mind that the parameter will not be visible in the Conversion reporting (unless Pinterest does some update in the future).

You can add additional parameters in a tag by clicking the Custom Parameters checkbox and entering Parameter Name and Value.

For example, if you want to send custom_event_name “spent 5 minutes”, you’d need to do this:

When you test the event, check the “Test events” section of the Pinterest Tag interface (ads.pinterest.com). In it, you’ll see CUSTOM event but if you click it, you’ll see more parameters that you will able to later use while building audiences.

Speaking of trivial events (such as scrolling), I would not send them as CUSTOM events because then your conversion reports would show way too many conversions (that are simply just regular events and don’t affect the business bottom-line).

 

#6.2. User-defined event

Important: I’ve had some wonky results when tracking user-defined events. Eventually, I realized that you can have only one user-defined event per pixel. For example, if you first send the user-defined event with the name “scroll” and then send an event called “engaged user”, only the latter will be displayed in places like audience builder. This is a super weird decision on Pinterest’s behalf. If I’m wrong or missing something, please let me know.

===

User-defined (a.k.a. partner-defined) event cannot be used in conversion reporting. But you can use it to build audiences. The implementation process here is a little different. We will need to combine the Custom HTML tag with the Pinterest Tag base code.

First, create a Pinterest Tag Base code (no event) tag, don’t assign any triggers, and then set this tag to fire only once per page.

Then create a Custom HTML tag with the following code:

<script>
pintrk(‘track’, ‘some_custom_name’, {
some_parameter: ‘parameter value’
});
</script>

Replace the some_custom_name with an actual event name. If you want to track scrolling, then you could change the values to these:

<script>
pintrk(‘track’, ‘scroll’, {
scroll_distance: {{Scroll Depth}}
});
</script>

{{Scroll Depth}} is a built-in variable in GTM (that you should enable together with the rest of the scroll setup).

If you don’t want to send any additional parameters (just the event name itself), you can reduce the code to this:

<script>
pintrk(‘track’, ‘engaged user’);
</script>

If you want to add more than one parameter, you can do the following:

<script>
pintrk(‘track’, ‘outbound link click’, {
file_name: {{file name}},
file_url: {{Click URL}}
});
</script>

{{file name}} is a custom variable that returns the name of the file and {{Click URL}} is a built-in GTM variable. To learn how to track file downloads, read this for inspiration.

When you have prepared the JavaScript code in the Custom HTML tag, assign the trigger. It depends on an interaction that you want to track thus I will not dive deeper into thousands of possible options. In this section, I presume that you are already familiar with event tracking in GTM well enough. If not (and you are looking for a fast way to get up-and-running), take a look at my courses.

Also, one more thing: in that Custom HTML tag, go to Advanced Settings > Tag Sequencing and select the previously created Base code tag as a setup tag. This setting will make sure that the Pinterest Tag code is loaded on a page and will process that Custom HTML tag’s code. In most cases, your regular Page visit tag will already have the pixel loaded on a page but it’s better to be safe than sorry.

Save the tag and test it (see chapter #3).

In the Test events section of Pinterest Ads, you will these events as UNKNOWN but if you expand the, you’ll see what data was sent to Pinterest.

 

#7. Creating audiences

I will run through this part very quickly (since the main focus of this blog post is “how to collect data”). If you want to create an audience based on the events you’ve sent, you can do that by going to Ads > Audiences (in the Pinterest interface) and create a new audience.

Then select Visitors who went to your site and select your pixel.

Then choose “Add a filter” and enter the conditions you are interested in. If you want to build on pageviews, just select URL contains and then enter the URL.

If you want to build an audience based on events,  choose Event in the dropdown, and then comes the weird-ish part (a bug in the UI). Hopefully, in the future, they will fix this.

If you click on the “Enter your value” field, then click somewhere outside of it and then click on the field once again, you’ll see the list of all events you can use.

After you select the event, you can be even more specific. Click Add a subrule and then enter the parameters you wish. If you click on the field, then click away and then click it again, you’ll see all the parameters you can choose from. That’s the same weird bug from the previous paragraph.

Keep in mind that retargeting is going to be more and more limited as privacy-enhancements are getting popular among most of the modern browsers.

 

#8. User Privacy Preferences

When you implement tracking pixels, don’t forget one thing, consent. If a visitor does not agree to be tracked for marketing purposes, you should block those tags in Google Tag Manager. And that applies to Pinterest Tag as well To learn more about how to implement the setup that respects user’s preferences, you can go here. It’s a quite complex setup but nobody said that privacy is easy.

 

#9. Reuse GA Enhanced Ecommerce data in Pinterest Tag

Here’s a cool thing (and that’s why I love Google Tag Manager so much). If you already have Google Analytics Enhanced Ecommerce implemented on a site (via Google Tag Manager), there is a high chance that your e-commerce data (about products, carts, purchases) is properly formatted and stored in the Data Layer.

With Google Tag Manager and some JavaScript magic, you can reuse that already-existing data from the Data Layer and send the same data to Pinterest Tag as well.

This is quite an extensive topic, that’s why I decided to post a separate blog post teaching you how to do that.

How to use GA Enhanced Ecommerce data in Pinterest Tag.

 

Implement Pinterest Tag with Google Tag Manager: Final Words

Since Pinterest tag is not as popular as Facebook Pixel, Google Analytics, or Google Ads, I had to browse through not-so-many not-so-in-depth resources in order to figure out how to configure it properly.

I mean, they were not terrible but they could definitely use some enhancements and more thorough examples in some cases.

To sum up:

There is a bunch of standard events that Pinterest tag supports. You should primarily use them.
Check Pinterest’s documentation to learn more about the parameters that you can send together with events. Some parameters are available as distinct fields in the Pinterest tag template, others can be added as custom parameters.
Pinterest’s data model looks quite flexible. If you want to add some custom parameters that are unique to your business, you can do that. I recommend following the following naming convention: all_lowercase_with_underscore.
While you cannot use custom parameters in conversion reporting (actually, the majority of standard parameters are also not displayed there, except value and order_quantity), you can still use them to build retargeting audiences (while retargeting is still a thing on some browsers).
Custom event tracking is quite limited. A decision to support only one user-defined variable is exceptionally weird, in my opinion.

This was a little new zone for me as well (as I don’t work a lot with Pinterest tag due to its much lower popularity).

If you notice any mistakes (which is totally possible) or got some additional tips that I did not discover myself, feel free to shoot a comment below. I’d love to learn even more.


The post Implement Pinterest Tag with Google Tag Manager appeared first on Analytics Mania.

Read MoreAnalytics Mania

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments