Uncaught TypeError: window.posthog.set_config is not a function after consent has been given

Created on 16 December 2024, 8 months ago

Problem/Motivation

After giving consent (doesn't happen if content denied), each page load gives the following error:

js_KFZYsMgLx0XMEw55l…h9deaOc2yfokHVi:252 Uncaught TypeError: window.posthog.set_config is not a function
    at Object.consentGiven (js_KFZYsMgLx0XMEw55l…aOc2yfokHVi:252:101)
    at HTMLDocument.<anonymous> (js_KFZYsMgLx0XMEw55l…aOc2yfokHVi:252:390)
    at Ai.fireEvent (cookiesjsr.min.js?v=10.3.10:12:28171)
    at Ai.setServices (cookiesjsr.min.js?v=10.3.10:12:28999)
    at HTMLButtonElement.o (cookiesjsr.min.js?v=10.3.10:12:31903)
    at HTMLButtonElement.<anonymous> (cookiesjsr.min.js?v=10.3.10:12:25654)
    at cookiesjsr.min.js?v=10.3.10:12:14424
    at qn (cookiesjsr.min.js?v=10.3.10:12:14154)
    at HTMLButtonElement.i (cookiesjsr.min.js?v=10.3.10:12:14415)

from here:

Drupal.behaviors.posthog_cookies = {
        consentGiven() {
            if (window.posthog)
                window.posthog.set_config({  // <<<<<<<<<<<<<<<< Uncaught TypeError: window.posthog.set_config is not a function
                    persistence: 'localStorage+cookie'
                });
        },

Steps to reproduce

See above

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code (posthog_cookies)

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024