DataLayer for Google Tag Manager
How To Configure
Purchase Extension

Related Extensions

Get more from your Magento2 store!

Magento Enhanced E-commerce

If your are using Magento + Google Analytics, then you need Enhanced E-commerce for Google Tag Manager.

Order Shipment Tracking

Providing your customer with a beautiful and functional order package tracking without leaving your site.

HTML Minifier for Magento2

Minification is the process of removing all unnecessary characters and spacing from your source code without changing its functionality.

Integrate Pinterest Conversion Pixel with Google Tag Manager

Product Page View
Tag Configuration
  Tag type : Custom Html

Trigger Configuration
  Trigger: All Custom Events
  Event Name : productPage

HTML

<script>
require(['DataLayerProductApi'], function (dataLayerProductApi) {
    var product = dataLayerProductApi();
    
    <!-- Pinterest Conversion Tag Code -->
    fbq('track', 'ViewContent', {
        content_name: product.getProduct('name'),
        content_category: product.getProduct('path'),
        content_ids: product.getProductSkus(),
        content_type: 'product',
        value: product.getProduct('price'),
        currency: product.getCurrencyCode()
    });
    <!-- End Pinterest Conversion Tag Code -->
});
</script>
Add To Cart
Tag Configuration
  Tag type : Custom Html

Trigger Configuration
  Trigger: All Custom Events
  Event Name : addToCart

HTML

<script>
require(['DataLayerProductApi'], function (dataLayerProductApi) {
    var product = dataLayerProductApi();
    
    <!-- Pinterest Conversion Tag Code -->      
    pintrk('track', 'AddToCart', {
        value: product.getAddedToCartTotal(),
        order_quantity: product.getAddedToCartQty(),
        currency: product.getCurrencyCode()
    });
    <!-- End Pinterest Conversion Tag Code -->
});
</script>
Purchase
Tag Configuration
  Tag type : Custom Html

Trigger Configuration
  Trigger: All Custom Events
  Event Name : purchase

HTML

<script>
require(['DataLayerPurchaseApi'], function (dataLayerPurchaseApi) {
    var purchase = dataLayerPurchaseApi();
    
    var pintFieldFormat = {
        renameFieldTo: {id: 'product_id', quantity: 'product_quantity', price: 'product_price', name: 'product_name'}
    };
    
    <!-- Pinterest Conversion Tag Code -->
    pintrk('track', 'checkout', {
        value: purchase.getOrder('total'),
        order_quantity: purchase.getItemCount(),
        currency: purchase.getCurrencyCode(),
        line_items: purchase.getItems(pintFieldFormat)
    });
    <!-- End Pinterest Conversion Tag Code -->
});
</script>

FAQs

Q: How to check if my base code and event codes are firing after adding to my site?

A: ​Your base code is correctly implemented if the tag shows a ‘verified’ status in the conversion manager. Click into your Pinterest Conversion Tag to check that your event codes are firing - you’ll see a dashboard on the right for Tag Event History. Here you can see all the events that have fired with your Pinterest Conversion Tag. You can check when Pinterest last saw the event fire, and how many raw pixels fired for the event in the past 24 hours.

Q: Do I still need to add the base code, on pages where I want to track an event?

A: ​Yes. You need base code on every page where event code is added. On pages where you want to track conversions you should have two tags, the base code and the event code. See section 4 for examples of base plus event code. Keep in mind your base code must run first before the event code runs.

Related

Related Extensions

Get more from your Magento2 store!

Magento Enhanced E-commerce

If your are using Magento + Google Analytics, then you need Enhanced E-commerce for Google Tag Manager.

DataLayer for Tag Manager

Whether you are integrating Bing, Facebook, SnapChat, Pinterest, or any other services our extension make it easy.

Order Shipment Tracking

Providing your customer with a beautiful and functional order package tracking without leaving your site.