Git Product home page Git Product logo

gtm-template-tag-google-ecommerce-data-transfer's Introduction

Custom Template for Google Tag Manager: Google Enhanced Ecommerce data transfer to remarketing pixels

This tag gets data from Google Enhanced Ecommerce configured via dataLayer and sends it to dynamic remarketing pixels:

This tag uses Google Enhanced Ecommerce configured via dataLayer to get event and product data, so you need it to be on your site, otherwise this tag will not work.

This tag intercepts dataLayer.push, so it should be fired only via All Pages or DOM Ready triggers.

You can run several copies of the tag on the page, for example, one for VK, the second for Facebook, etc.

The tag injects this script to the site for its work.

If your security policy does not allow loading third-party scripts, you can install this data transfer script as a GTM Custom HTML tag. In this case, no third-party scripts will be loaded to your site. To do this, fill the settings object in the code with your data and set All Pages trigger for this GTM Custom HTML tag.

Events and event data structure

Pixels events and data structure of each event are compiled in accordance with the official documentation of each pixel.

The tag doesn't add anything from itself to the event or product data, it takes only what is in Google Enhanced Ecommerce. If Google Enhanced Ecommerce is missing something, it will be absent in dynamic remarketing pixels as well.

Description of events and data structures:

Website homepage view.

Event data structure:

{
    priсeListID, // Price list ID
    name, // Event name
    {
        [
            {
                id, // Product ID
                group_id, // Product brandname
                price // Product price
            },
            
        ],
        category_ids // Product categories, for example: 'phones,tablets,headphones'
    }
}

Website catalog page view.

Event data structure:

{
    priсeListID, // Price list ID
    name, // Event name
    {
        [
            {
                id, // Product ID
                group_id, // Product brandname
                price // Product price
            },
            
        ],
        category_ids // Product categories, for example: 'phones,tablets,headphones'
    }
}

Page with site search results view.

Event data structure:

{
    priсeListID, // Price list ID
    name, // Event name
    {
        [
            {
                id, // Product ID
                group_id, // Product brandname
                price // Product price
            },
            
        ],
        category_ids, // Product categories, for example: 'phones,tablets,headphones'
        search_string // Search query
    }
}

Other page view.

Event data structure:

{
    priсeListID, // Price list ID
    name, // Event name
    {
        [
            {
                id, // Product ID
                group_id, // Product brandname
                price // Product price
            },
            
        ],
        category_ids // Product categories, for example: 'phones,tablets,headphones'
    }
}

Product detail view.

Event data structure:

{
    priсeListID, // Price list ID
    name, // Event name
    {
        [
            {
                id, // Product ID
                group_id, // Product brandname
                price // Product price
            },
            
        ],
        category_ids, // Product categories, for example: 'phones,tablets,headphones'
        currency_code, // Currency code
        total_price // Total price
    }
}

Add product to cart.

Event data structure:

{
    priсeListID, // Price list ID
    name, // Event name
    {
        [
            {
                id, // Product ID
                group_id, // Product brandname
                price // Product price
            },
            
        ],
        category_ids, // Product categories, for example: 'phones,tablets,headphones'
        currency_code, // Currency code
        total_price // Total price
    }
}

Remove product from cart.

Event data structure:

{
    priсeListID, // Price list ID
    name, // Event name
    {
        [
            {
                id, // Product ID
                group_id, // Product brandname
                price // Product price
            },
            
        ],
        category_ids, // Product categories, for example: 'phones,tablets,headphones'
        currency_code, // Currency code
        total_price // Total price
    }
}

Checkout process start.

Event data structure:

{
    priсeListID, // Price list ID
    name, // Event name
    {
        [
            {
                id, // Product ID
                group_id, // Product brandname
                price // Product price
            },
            
        ],
        category_ids, // Product categories, for example: 'phones,tablets,headphones'
        currency_code, // Currency code
        total_price // Total price
    }
}

Product purchase.

Event data structure:

{
    priсeListID, // Price list ID
    name, // Event name
    {
        [
            {
                id, // Product ID
                group_id, // Product brandname
                price // Product price
            },
            
        ],
        category_ids, // Product categories, for example: 'phones,tablets,headphones'
        currency_code, // Currency code
        total_price // Total price
    }
}

Website homepage view.

Event data structure:

{
    'trackCustom', // Method of data send
    name, // Event name
    {
        [
            {
                id, // Product ID
                quantity, // Product quantity
                item_price // Product price
            },
            
        ],
        content_name, // Product names, for example: 'Apple iPhone X Black,Samsung Galaxy A80 128Gb'
        content_type // Product type
    }
}

Website catalog page view.

Event data structure:

{
    'trackCustom', // Method of data send
    name, // Event name
    {
        [
            {
                id, // Product ID
                quantity, // Product quantity
                item_price // Product price
            },
            
        ],
        content_name, // Product names, for example: 'Apple iPhone X Black,Samsung Galaxy A80 128Gb'
        content_type // Product type
    }
}

Page with site search results view.

Event data structure:

{
    'track', // Method of data send
    name, // Event name
    {
        [
            {
                id, // Product ID
                quantity, // Product quantity
                item_price // Product price
            },
            
        ],
        content_category, // Product categories, for example: 'phones,tablets,headphones'
        search_string // Search query
    }
}

Other page view.

Event data structure:

{
    'trackCustom', // Method of data send
    name, // Event name
    {
        [
            {
                id, // Product ID
                quantity, // Product quantity
                item_price // Product price
            },
            
        ],
        content_name, // Product names, for example: 'Apple iPhone X Black,Samsung Galaxy A80 128Gb'
        content_type // Product type
    }
}

Product detail view.

Event data structure:

{
    'track', // Method of data send
    name, // Event name
    {
        [
            {
                id, // Product ID
                quantity, // Product quantity
                item_price // Product price
            },
            
        ],
        content_name, // Product names, for example: 'Apple iPhone X Black,Samsung Galaxy A80 128Gb'
        content_type, // Product type
        currency, // Currency code
        value // Total price 
    }
}

Add product to cart.

Event data structure:

{
    'track', // Method of data send
    name, // Event name
    {
        [
            {
                id, // Product ID
                quantity, // Product quantity
                item_price // Product price
            },
            
        ],
        content_name, // Product names, for example: 'Apple iPhone X Black,Samsung Galaxy A80 128Gb'
        content_type, // Product type
        currency, // Currency code
        value // Total price 
    }
}

Remove product from cart.

Event data structure:

{
    'trackCustom', // Method of data send
    name, // Event name
    {
        [
            {
                id, // Product ID
                quantity, // Product quantity
                item_price // Product price
            },
            
        ],
        content_name, // Product names, for example: 'Apple iPhone X Black,Samsung Galaxy A80 128Gb'
        content_type, // Product type
        currency, // Currency code
        value // Total price 
    }
}

Checkout process start.

Event data structure:

{
    'track', // Method of data send
    name, // Event name
    {
        [
            {
                id, // Product ID
                quantity, // Product quantity
                item_price // Product price
            },
            
        ],
        content_category, // Product categories, for example: 'phones,tablets,headphones'
        num_items, // Number of product items
        currency, // Currency code
        value // Total price 
    }
}

Product purchase.

Event data structure:

{
    'track', // Method of data send
    name, // Event name
    {
        [
            {
                id, // Product ID
                quantity, // Product quantity
                item_price // Product price
            },
            
        ],
        content_name, // Product names, for example: 'Apple iPhone X Black,Samsung Galaxy A80 128Gb'
        content_type, // Product type
        currency, // Currency code
        value, // Total price 
        num_items // Number of product items
    }
}

Website homepage view.

Event data structure:

{
    id, // Counter ID
    type, // Event type
    [productid, ], // Product ID(s)
    pagetype, // Event name
    list // Feed ID
}

Website catalog page view.

Event data structure:

{
    id, // Counter ID
    type, // Event type
    [productid, ], // Product ID(s)
    pagetype, // Event name
    list // Feed ID
}

Page with site search results view.

Event data structure:

{
    id, // Counter ID
    type, // Event type
    [productid, ], // Product ID(s)
    pagetype, // Event name
    list // Feed ID
}

Other page view.

Event data structure:

{
    id, // Counter ID
    type, // Event type
    [productid, ], // Product ID(s)
    pagetype, // Event name
    list // Feed ID
}

Product detail view.

Event data structure:

{
    id, // Counter ID
    type, // Event type
    [productid, ], // Product ID(s)
    pagetype, // Event name
    list, // Feed ID
    totalvalue // Total price
}

Add product to cart.

Event data structure:

{
    id, // Counter ID
    type, // Event type
    [productid, ], // Product ID(s)
    pagetype, // Event name
    list, // Feed ID
    totalvalue // Total price
}

Product purchase.

Event data structure:

{
    id, // Counter ID
    type, // Event type
    [productid, ], // Product ID(s)
    pagetype, // Event name
    list, // Feed ID
    totalvalue // Total price
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.