window.lintrk is not a function reaches Error Tracking as an unhandled TypeError:
24 events across 5 sessions in 30 days, 12 of them from a single session in the last 24h. All on
the / entry point.
lintrk appears nowhere in this repo. It is the LinkedIn Insight Tag, injected by the GTM container
(GTM-5QQX432, loaded from useGTM() in src/App.tsx). GTM inserts an inline snippet that calls
window.lintrk(...); when snap.licdn.com/li.lms-analytics/insight.min.js has not loaded — blocked
by an ad blocker, or just slower than the snippet — the call throws.
Why shouldKeepEvent cannot drop it
The stack is:
TypeError: window.lintrk is not a function
at <anonymous> @ <anonymous>:1:8 <- GTM's inline script
at Node.insertBefore @ .../assets/index-D9wn3O9N.js:825:42836 <- OUR code
at <anonymous> @ https://www.googletagmanager.com/...
at CS @ https://www.googletagmanager.com/...
... (all remaining frames googletagmanager.com)
originatesInThirdPartyScript in src/integrations/datadog/shouldKeepEvent.ts returns false as
soon as one located frame is neither static.reo.dev, nor *-extension://, nor
/assets/vendor-datadog-*.js. The Node.insertBefore frame is ours: it is
src/lib/installBrowserTranslationDomGuard.ts:52-53, which patches Node.prototype.insertBefore
globally (the #1388 browser-translation fix). Confirmed by reading the deployed chunk at exactly that
offset:
let r=Node.prototype.insertBefore;Node.prototype.insertBefore=function(e,t){
return t instanceof Node&&t.parentNode!==this?r.call(this,e,null):r.call(this,e,t)}
So the filter is working as written — but that global patch puts a first-party frame on the stack of
every third-party script that inserts a DOM node, and an inline <script> executes synchronously
during insertion, so anything it throws propagates through our frame. This is broader than LinkedIn:
any vendor tag that throws while being injected is now attributed to Studio.
Options
- Add
www.googletagmanager.com (and snap.licdn.com) to THIRD_PARTY_SCRIPT_FRAME. Smallest change,
and consistent with the comment already on that constant.
- Or make
originatesInThirdPartyScript treat the DOM-guard frame the way it treats
INSTRUMENTATION_FRAME — it is our code but it is never the cause, only a shim on the path. This
is the more general fix, and it would also cover the next vendor tag.
Volume is low, so this is hygiene rather than urgent: it costs one Error Tracking issue and a
bursty 12-events-per-session tail. Related third-party-attribution issues: #1645, #1659, #1620.
Related to #1684, which covers the cost of loading these tags eagerly in the first place.
window.lintrk is not a functionreaches Error Tracking as an unhandledTypeError:24 events across 5 sessions in 30 days, 12 of them from a single session in the last 24h. All on
the
/entry point.lintrkappears nowhere in this repo. It is the LinkedIn Insight Tag, injected by the GTM container(
GTM-5QQX432, loaded fromuseGTM()insrc/App.tsx). GTM inserts an inline snippet that callswindow.lintrk(...); whensnap.licdn.com/li.lms-analytics/insight.min.jshas not loaded — blockedby an ad blocker, or just slower than the snippet — the call throws.
Why
shouldKeepEventcannot drop itThe stack is:
originatesInThirdPartyScriptinsrc/integrations/datadog/shouldKeepEvent.tsreturnsfalseassoon as one located frame is neither
static.reo.dev, nor*-extension://, nor/assets/vendor-datadog-*.js. TheNode.insertBeforeframe is ours: it issrc/lib/installBrowserTranslationDomGuard.ts:52-53, which patchesNode.prototype.insertBeforeglobally (the #1388 browser-translation fix). Confirmed by reading the deployed chunk at exactly that
offset:
So the filter is working as written — but that global patch puts a first-party frame on the stack of
every third-party script that inserts a DOM node, and an inline
<script>executes synchronouslyduring insertion, so anything it throws propagates through our frame. This is broader than LinkedIn:
any vendor tag that throws while being injected is now attributed to Studio.
Options
www.googletagmanager.com(andsnap.licdn.com) toTHIRD_PARTY_SCRIPT_FRAME. Smallest change,and consistent with the comment already on that constant.
originatesInThirdPartyScripttreat the DOM-guard frame the way it treatsINSTRUMENTATION_FRAME— it is our code but it is never the cause, only a shim on the path. Thisis the more general fix, and it would also cover the next vendor tag.
Volume is low, so this is hygiene rather than urgent: it costs one Error Tracking issue and a
bursty 12-events-per-session tail. Related third-party-attribution issues: #1645, #1659, #1620.
Related to #1684, which covers the cost of loading these tags eagerly in the first place.