Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

8.8 KB
Raw Blame
{
  "exportFormatVersion": 2,
  "exportTime": "2026-10-15 00:00:00",
  "containerVersion": {
    "path": "accounts/0/containers/0/versions/0",
    "accountId": "0",
    "containerId": "0",
    "containerVersionId": "0",
    "container": {
      "path": "accounts/0/containers/0",
      "accountId": "0",
      "containerId": "0",
      "name": "Conversion Detection - Cal.com",
      "publicId": "GTM-XXXXXXX",
      "usageContext": [
        "WEB"
      ],
      "fingerprint": "0",
      "tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/0/containers/0/workspaces/0"
    },
    "tag": [
      {
        "accountId": "0",
        "containerId": "0",
        "tagId": "1",
        "name": "Conversion Detection - Cal.com Booking Listener",
        "type": "html",
        "parameter": [
          {
            "type": "TEMPLATE",
            "key": "html",
            "value": "<script>\n(function () {\n  'use strict';\n  if (window.__ctDetectCalcom) return;\n  window.__ctDetectCalcom = true;\n  window.dataLayer = window.dataLayer || [];\n\n  // Cal.com's embed code (inline, popup and floating button) renders an iframe\n  // from https://app.cal.com; a booking page pasted in as a plain iframe loads\n  // from https://cal.com. Each posts from its own origin, so a frame is only\n  // trusted for the origin its address starts with. The CSS selectors do that\n  // prefix match so this listener never reads an iframe's address, because\n  // Cal.com prefill parameters can carry a name or email.\n  var CAL_FRAMES = [\n    { selector: 'iframe[src^=\"https://app.cal.com/\"]', origin: 'https://app.cal.com' },\n    { selector: 'iframe[src^=\"https://cal.com/\"]', origin: 'https://cal.com' }\n  ];\n  var UID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;\n  var STATUS_PATTERN = /^[A-Z_]{1,32}$/;\n  var trackedFrames = [];\n  var seenUids = [];\n\n  function trackFrame(frame, origin) {\n    if (!frame || !frame.contentWindow) return;\n    for (var i = 0; i < trackedFrames.length; i++) {\n      if (trackedFrames[i].frame === frame) {\n        trackedFrames[i].origin = origin;\n        return;\n      }\n    }\n    trackedFrames.push({ frame: frame, origin: origin });\n  }\n\n  function scan(root) {\n    if (!root || typeof root.querySelectorAll !== 'function') return;\n    for (var k = 0; k < CAL_FRAMES.length; k++) {\n      var frames;\n      try { frames = root.querySelectorAll(CAL_FRAMES[k].selector); } catch (e) { continue; }\n      for (var i = 0; i < frames.length; i++) trackFrame(frames[i], CAL_FRAMES[k].origin);\n    }\n  }\n\n  // The message must come from a Cal.com frame that is on this page right now,\n  // and from the origin that frame was loaded from. Cal.com re-creates popup\n  // frames, so a frame seen earlier is re-checked live.\n  function sourceIsTracked(message) {\n    for (var i = 0; i < trackedFrames.length; i++) {\n      var item = trackedFrames[i];\n      try {\n        if (item.frame.isConnected === true && item.frame.contentWindow === message.source && item.origin === message.origin) return true;\n      } catch (e) { /* replaced or inaccessible frames fail closed */ }\n    }\n    return false;\n  }\n\n  function isCalOrigin(origin) {\n    for (var k = 0; k < CAL_FRAMES.length; k++) if (CAL_FRAMES[k].origin === origin) return true;\n    return false;\n  }\n\n  function isPlainObject(value) {\n    return !!value && typeof value === 'object' && Object.prototype.toString.call(value) === '[object Object]';\n  }\n\n  function uidSeen(uid) {\n    for (var i = 0; i < seenUids.length; i++) if (seenUids[i] === uid) return true;\n    return false;\n  }\n\n  function onMessage(message) {\n    if (!message || !message.source || message.source === window) return;\n    if (!isCalOrigin(message.origin)) return;\n    // A frame added since the last scan (a popup that just opened) is picked up here.\n    if (!sourceIsTracked(message)) {\n      scan(document);\n      if (!sourceIsTracked(message)) return;\n    }\n    var data = message.data;\n    if (typeof data === 'string') {\n      try { data = JSON.parse(data); } catch (e) { return; }\n    }\n    // Only a completed new booking. Reschedules (rescheduleBookingSuccessfulV2)\n    // and the deprecated V1 events, which carry the attendee's details, never match.\n    if (!isPlainObject(data) || data.originator !== 'CAL' || data.type !== 'bookingSuccessfulV2') return;\n    var booking = data.data;\n    if (!isPlainObject(booking) || typeof booking.uid !== 'string' || !UID_PATTERN.test(booking.uid)) return;\n    if (uidSeen(booking.uid)) return;\n    // Only these three values are copied. The booking title names the attendee,\n    // so it and every other field are left behind.\n    var push = { event: 'calcom_booking_successful', booking_uid: booking.uid };\n    if (typeof booking.eventTypeId === 'number' && isFinite(booking.eventTypeId)) push.event_type_id = String(booking.eventTypeId);\n    if (typeof booking.status === 'string' && STATUS_PATTERN.test(booking.status)) push.booking_status = booking.status;\n    // The ID is remembered only once the push went through, so a dataLayer\n    // that throws (a broken wrapper) never escapes into the page, and a\n    // repeat of the same message can still be counted.\n    try {\n      window.dataLayer = window.dataLayer || [];\n      window.dataLayer.push(push);\n    } catch (e) {\n      return;\n    }\n    seenUids.push(booking.uid);\n  }\n\n  function start() {\n    if (typeof document === 'undefined') return;\n    scan(document);\n    if (typeof MutationObserver === 'undefined' || !document.documentElement) return;\n    try {\n      var observer = new MutationObserver(function (mutations) {\n        for (var i = 0; i < mutations.length; i++) {\n          var added = mutations[i].addedNodes || [];\n          for (var j = 0; j < added.length; j++) {\n            var node = added[j];\n            if (node && node.tagName === 'IFRAME') scan(document);\n            else scan(node);\n          }\n          if (mutations[i].type === 'attributes' && mutations[i].attributeName === 'src') scan(document);\n        }\n      });\n      observer.observe(document.documentElement, { childList: true, subtree: true, attributes: true, attributeFilter: ['src'] });\n    } catch (e) {}\n  }\n\n  if (typeof document !== 'undefined') {\n    if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start, false);\n    else start();\n  }\n  window.addEventListener('message', onMessage, false);\n})();\n</script>"
          },
          {
            "type": "BOOLEAN",
            "key": "supportDocumentWrite",
            "value": "false"
          }
        ],
        "firingTriggerId": [
          "2147479553"
        ],
        "tagFiringOption": "ONCE_PER_EVENT",
        "monitoringMetadata": {
          "type": "MAP"
        },
        "consentSettings": {
          "consentStatus": "NOT_SET"
        }
      }
    ],
    "trigger": [
      {
        "accountId": "0",
        "containerId": "0",
        "triggerId": "2",
        "name": "CE - Cal.com Booking Successful",
        "type": "CUSTOM_EVENT",
        "customEventFilter": [
          {
            "type": "EQUALS",
            "parameter": [
              {
                "type": "TEMPLATE",
                "key": "arg0",
                "value": "{{_event}}"
              },
              {
                "type": "TEMPLATE",
                "key": "arg1",
                "value": "calcom_booking_successful"
              }
            ]
          }
        ],
        "filter": []
      }
    ],
    "variable": [
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "1",
        "name": "DLV - Cal.com Booking UID",
        "type": "v",
        "parameter": [
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "booking_uid"
          },
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          }
        ]
      },
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "2",
        "name": "DLV - Cal.com Event Type ID",
        "type": "v",
        "parameter": [
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "event_type_id"
          },
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          }
        ]
      },
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "3",
        "name": "DLV - Cal.com Booking Status",
        "type": "v",
        "parameter": [
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "booking_status"
          },
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          }
        ]
      }
    ],
    "fingerprint": "0",
    "tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/0/containers/0/versions/0"
  }
}