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

141
Views
Send Event gtag code to Analytics for Goal setup

I am looking to set up conversion tracking from an iframe, using the gtag code below (which is inserted into the iframe code), but how do I set up the goal in Analytics to "receive" this event? Do I need to add event_category, event_action etc?

tag.src = "https://www.googletagmanager.com/gtag/js?id=XXXXXXXXXX";
document.getElementsByTagName("head")[0].appendChild(tag);
window.dataLayer = window.dataLayer || [];
function gtag() {
  dataLayer.push(arguments);
}

gtag("js", new Date());

gtag("event", "booking_init");

gtag("config", "YOUR_TRACKER_CODE");

document.addEventListener("click", function (e) {
  e.path.forEach(function (pI) {
    if (pI.className && pI.className.indexOf("ant-select-dropdown-menu-item") != -1) {
      gtag(
        "event",
        pI.firstChild.className,
        {
          value: pI.firstChild.title,
        }
      );
    }

    if (pI.className && pI.className.indexOf("booking-form-date") != -1) {
      gtag("event", "booking-form-date");
    }

    if (pI.className && pI.className.indexOf("ant-btn") != -1) {
      gtag("event", "button", { value: pI.innerText });
    }
  });
});```
about 4 years ago · Juan Pablo Isaza
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!