This website uses cookies to ensure you get the best experience on our website.

Skip to content
LOGO
  • Company

    About IGNEK

    Learn about our story and our mission.

    Careers

    We're hiring!

    We always looking for talented peoples. Join our team!

    Blogs

    The latest industry news, updates and info.

    Case Studies

    Take a closer look at the projects we've delivered

    Webinar

    Watch our latest organized webinar

    Get in touch with our HR team

    • hr@ignek.com
    • +91 93284 95160
    • Ahmedabad, Gujarat, India – 382470
  • Services

    Enterprise Portal Development

    Custom Enterprise Portal Development for flawless Solutions

    Dedicated Development Team

    Expand Teams, Optimize Development with Our Expertise

    Back-end Development

    Empowering your digital presence with robust backend development expertise

    Front-end Development

    Crafting engaging user experiences through expert frontend development

    Digital Transformation

    Embrace digital transformation by modernizing process

    SaaS Development

    Transform your business with SaaS Innovative Solutions

    Technologies

    Liferay Services

    Development & Customization

    Theme

    Upgradation

    Migration

    Proof of Concept

    Performance Tunning

    Architecture

    Support & Maintenance

    E-commerce

    Expert Advice

    React Services

    Enterprise Development

    Custom Application

    Single Page Application

    Architecture

    API Integration

    Migration

    Consulting

    Maintenance & Support

    Spring Boot Services

    Web Service

    MVC Web Development

    API Integration

    Security

    Migration

    Microservices

    Support & Maintenance

    AEM Services

    Consulting Service

    Site Development

    Migration & Upgradation

    Integration

    Maintenance & Support

    Custom Solutions

    Content Management

    Team Augementation

  • Solution

    Ready for digital excellence

    In our rapidly evolving world, businesses are always on the lookout for fresh ways to improve their operations and connect with their audiences.

    Contact US

    Solutions

    SaaS : Software As A Service

    Transforming industries through cutting edge SaaS solutions.

    Customer Portal : Boost Business Productivity

    Streamline operations and enhance productivity with our Customer Portal solution.

    Liferay Based Intranet Portal

    Internal portal for company communication, collaboration and resources

    Integration

    Matomo Integration with Liferay

    Integrate Matomo to enable user interactions seamlessly.

    Microsoft Teams integration with Liferay

    Integrate to enable seamless collaboration, messaging within your portal.

    Jira Integration With Liferay

    Optimizes business operations by integrating with Jira.

  • Hire Us

    Liferay

    Get expert Liferay developers for seamless portal solutions.

    React JS

    Get expert ReactJS developers for dynamic web solutions.

    Web Developer

    Get custom web solutions from IGNEK's expert developers.

    Spring Boot

    Get top-notch Spring Boot developers for your project success!

    Healthcare

    Get top Healthcare Developers for cutting-edge medical software.

    MERN Stack

    Get expert MERN developers from IGNEK for custom, innovative project solutions.

    Why Hire Developers From IGNEK ?

    • Certified Developer
    • Transparent Communication
    • Flexible Hiring Modals
    • Fully Signed NDA
    • Cost Effective
    • Easy Exit Policy

    Get in touch with our Sales team

    • sales@ignek.com
    • +91 6351576580
    • info@ignek.com
    • Ahmedabad, Gujarat, India – 382470
SCHEDULE CALL
  • COMPANY
    • About
    • Case Studies
    • Blogs
    • Career
    • Webinar
  • SERVICES
    • Enterprise Portal Development
    • Dedicated Development Team
    • Back-end Development
    • Front-end Development
    • Digital Transformation
    • SaaS Development
  • SOLUTION
    • Customer Portal:  Boost Business Productivity
    • SaaS : Software as a Service
    • Liferay Based Employee Intranet Portal
  • TECHNOLOGY
    • Liferay Services
      • Liferay Development and Customization
      • Liferay Theme Development Service
      • Liferay DXP 7.4 Upgrade
      • Liferay Migration
      • Liferay Proof Of Concept
      • Liferay Performance Tuning
      • Liferay Architecture Design Service
      • Liferay Support And Maintenance Service
      • Liferay Ecommerce Development
      • Liferay Expert Advice
    • ReactJS Services
      • ReactJS Enterprise Application Development
      • ReactJS Custom Application Development
      • ReactJS Single Page Application Development (SPA)
      • ReactJS Applications Architecture
      • ReactJS API Integration
      • ReactJS Migration
      • ReactJS Consulting
      • ReactJS Maintenance and Support
    • Spring Boot Services
      • Spring Boot Web Development Service
      • Spring MVC Web Development
      • Spring Boot API Integration Service
      • Spring Boot Security
      • Spring Boot Migration Service
      • Spring Boot Microservices
      • Spring Boot Support & Maintenance Service
    • AEM Development Services
      • AEM Consulting Services
      • AEM Site Development
      • AEM Migration & Upgradation
      • AEM Integration Services
      • AEM Maintenance & Support
      • AEM Content Management
      • Custom AEM Solutions
      • AEM Team Augmentation
  • INTEGRATION
  • HIRE US
    • Hire Liferay Developer
    • Hire ReactJS Developer
    • Hire Spring Boot Developer
    • Hire Healthcare Developer
    • Hire Web Developer
    • Hire MERN Stack Developer
  • CONTACT US
  • Company

    About IGNEK

    Careers

    We're hiring!

    Blogs

    Case Studies

    Webinar

    Get in touch with our HR team

    • hr@ignek.com
    • +91 93284 95160
    • Ahmedabad, Gujarat, India – 382470
  • Services

    Enterprise Portal Development

    Dedicated Development Team

    Back-end Development

    Front-end Development

    Digital Transformation

    SaaS Development

    Technologies

    Liferay Liferay Services
    • Development & Customization
    • Theme
    • Upgradation
    • Migration
    • Proof of Concept
    • Performance Tuning
    • Architecture
    • Support & Maintenance
    • E-commerce
    • Expert Advice
    React React Services
    • Enterprise Development
    • Custom Application
    • Single Page Application
    • Architecture
    • API Integration
    • Migration
    • Consulting
    • Maintenance & Support
    Spring Boot Spring Boot Services
    • Web Service
    • MVC Web Development
    • API Integration
    • Security
    • Migration
    • Microservices
    • Support & Maintenance
    AEM AEM Services
    • Consulting Service
    • Site Development
    • Migration & Upgradation
    • Integration
    • Maintenance & Support
    • Custom Solutions
    • Content Management
    • Team Augmentation
  • Solution

    Ready for digital excellence

    In our rapidly evolving world, businesses are always on the lookout for fresh ways to improve their operations and connect with their audiences.

    Contact US

    Solutions

    SaaS : Software As A Service

    Customer Portal : Boost Business Productivity

    Liferay Based Intranet Portal

    Integration

    Matomo Integration with Liferay

    Microsoft Teams integration with Liferay

    Jira Integration With Liferay

  • Hire Us

    Liferay

    React JS

    Web Developer

    Spring Boot

    Healthcare

    MERN Stack

    Why Hire Developers From IGNEK ?

    • Certified Developer
    • Transparent Communication
    • Flexible Hiring Modals
    • Fully Signed NDA
    • Cost Effective
    • Easy Exit Policy

    Get in touch with our Sales team

    • sales@ignek.com
    • +91 6351576580
    • IGNEK
    • Ahmedabad, Gujarat, India – 382470
  • SCHEDULE CALL

Google Analytics with Liferay Client Extension

  • Liferay
  • November 15, 2024

Share On :

Introduction

Google Tag Manager (GTM) is a powerful tool that simplifies the process of adding, managing, and deploying marketing and analytics tags on your website without requiring constant updates to the website’s code. It allows you to manage all your tags (like Google Analytics, Facebook Pixel, and other third-party scripts) in one place, without having to rely on a developer for every change.

In Liferay, adding GTM to your site can help you track important user interactions, optimize marketing efforts, and improve your site’s performance without the need to modify the core codebase. This blog will guide you through the steps to implement GTM in a Liferay environment using both the <script> and <noscript> tags.

Prerequisites
  • Liferay 7.4 DXP
  • Java 11
Steps to Add Google Tag Manager

In this guide, we are using Liferay Client Extensions to add Google Tag Manager (GTM) without modifying the theme or requiring direct access to the HTML head. This method allows you to easily manage and deploy GTM across your Liferay pages.

  1. Create a GTM Account
    • If you don’t already have a GTM account, go to the Google Tag Manager website.
    • Sign in with your Google account and create a new GTM container. A container holds all the tags for your website or app.
    • Once the container is created, Google will provide you with two pieces of code: the <script> tag for the <head> section and the <noscript> tag for the <body> section.
  1. Obtain the GTM Code

You will receive two snippets from Google:

    • The first code (JavaScript) goes inside the <head> section of your site:
				
					


				
			
    • The second code (for users with disabled JavaScript) goes right after the <body> tag
				
					
//

var noscriptTag = document.createElement('noscript');

var iframeTag = document.createElement('iframe');
iframeTag.src = "https://www.googletagmanager.com/ns.html?id=GTM-NHWWPG";
iframeTag.height = "0";
iframeTag.width = "0";
iframeTag.style.display = "none";
iframeTag.style.visibility = "hidden";

noscriptTag.appendChild(iframeTag);

document.body.insertAdjacentElement('afterbegin', noscriptTag);

//


				
			
  1. Add the GTM Script in Liferay

There are multiple ways to add GTM code to your Liferay site, depending on your environment and permissions. Here’s how to do it using Client Extension in Page Settings.

  • How to add the first code (JavaScript)
    • Create a file with .js extension using any text editor and remove the <script> tag.
				
					
(function (w, d, s, l, i) {
      w[l] = w[l] || [];
      w[l].push({
         'gtm.start': new Date().getTime(),
         event: 'gtm.js'
      });
      var f = d.getElementsByTagName(s)[0],
         j = d.createElement(s),
         dl = l != 'dataLayer' ? '&l=' + l : '';
      j.async = true;
      j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
      f.parentNode.insertBefore(j, f);
   })(window, document, 'script', 'dataLayer', 'GTM-XXXXXXX'); 


				
			
    • Log in to Liferay as an administrator.
    • Upload the file in document and media and copy the path of that file.
    • Select client extension from Global Menu.
Location of Client extension
    • Create JS client extension by selecting “Add JS”.
Adding JS file in Client Extension
    • Give the name and URL that we copied from document ad media.
Title and JS URL in Client Extension
    • Save the client extension.
    • Open the Page settings and scroll down to  javascript extension section.
Page Settings in Liferay
    • Add the client extension in page head.
How to add Client Extension in Liferay
  • The second code (for users with disabled JavaScript)
    • To add the <noscript> part, inject it using JavaScript.
				
					
//

var noscriptTag = document.createElement('noscript');
var iframeTag = document.createElement('iframe');
iframeTag.src = "https://www.googletagmanager.com/ns.html?id=GTM-NHWWPG";
iframeTag.height = "0";
iframeTag.width = "0";
iframeTag.style.display = "none";
iframeTag.style.visibility = "hidden";

noscriptTag.appendChild(iframeTag);

document.body.insertAdjacentElement('afterbegin', noscriptTag);

//


				
			
    • Follow the same steps from 1 to 8 as mentioned for the first code (JavaScript).
    • Add the client extension in the page body.
    • Save the changes.
Conclusion

Adding Google Tag Manager to your Liferay site is a straightforward process that empowers you to manage tags and tracking more efficiently. Whether you use Liferay’s Custom Scripts, Fragments, or theme customization, implementing GTM ensures you’re able to track and optimize user behavior with minimal code changes.

By following the steps in this guide, you can have GTM up and running quickly, allowing for more flexibility in tracking, marketing, and analytics.

Explore Our Services

Discover how we can help your business thrive, whether you’re running a small startup, an SME, or a large enterprise. We’re here to understand your unique needs and goals, offering the expertise and resources to support your journey to success.

Stay informed about our Liferay services and updates by subscribing to our newsletter—just fill in the details below to subscribe.

Loading
Loading...

Related Blogs

July 10, 2023
Google Meet integration with Liferay Cover Image
Google Meet integration with Liferay
July 8, 2024
Zoom Integration With Liferay
Zoom integration with Liferay
October 4, 2024
OOTB Chat Integration with Liferay
OOTB Chat Integration With Liferay
Loading...

Featured Projects Portfolios

March 21, 2024
EPF Government Enterprise Website _ Multilingual, Access for Member, Employer, Corporate - New
EPF Government Enterprise Website : Multilingual, Access for Member, Employer, Corporate
June 19, 2024
Music License Management Portal _ Onboarding & Data Integrity
Music License Management Portal : Onboarding & Data Integrity

Digital Solutions for Your Business with IGNEK

4.9

5.0

5.0

5.0

LOGO

Making the world a better place through constructing elegant hierarchies

COMPANY

  • About
  • Career
  • Case Study
  • Blogs

SERVICES

  • Enterprise Portal Development
  • Dedicated Development Team
  • Back-end Development
  • Front-end Development
  • Digital Transformation
  • SaaS Development

HIRE US

  • Liferay
  • Spring Boot
  • ReactJS
  • Healthcare
  • MERN Stack
  • AEM

CONTACT

  • info@ignek.com
  • info@ignek.com
SALES
  • sales@ignek.com
  • (+91) 635 157 6580
CAREER
  • hr@ignek.com
  • (+91) 932 849 5160
  • E 910-912, Ganesh Glory 11, Jagatpur Road, SG Highway, Ahmedabad, Gujarat - 382470

© 2018-2025 IGNEK, Inc. All rights reserved

Linkedin Facebook X-twitter Instagram