Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
Pull the Report Title into the JavaScript used in a Custom Control Page Module

I am working on adding the Google Analytics code, to my Cognos reports, to help track usage from our website. I have created a page module custom control that does work correctly when the report page loads. The code currently sets the report name manually in the code. I want to have the control dynamically get the report name. The code for the page module is:

define( ["https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"], function() {

function PageModule()
{};
 
PageModule.prototype.load = function( oPage )
{
 window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-XXXXXXXXXX', {
  'page_title' : 'Cognos Report Name'
});
};

I know Cognos has a function that will get the report name when added in a query item. I am trying to get the same report name pulled into the custom control without having to add a unique query item in the report. Is it possible to get the report name using JavaScript, and if so, what code do I need to insert in place of Cognos Report Name? Any suggestions would be greatly appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I received a reply from dougp to my posting, on cognoise, that resolved my problem. Here is the final code which is based on Google Analytics 4.

define( ["https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"], function() {

function PageModule()
{};
 
PageModule.prototype.load = function( oPage )
{

window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-XXXXXXXXXX',
  { 'page_title': (new DOMParser()).parseFromString(oPage.application.Document.reportXML, "text/xml").getElementsByTagName("reportName")[0].childNodes[0].nodeValue }
  );
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!