Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable Google Tag Manager console logging

After I added Google Tag Manager to the project I see lots its log entries in the console. Is there a way to disable it? Console log is full of noise:

GoogleTagManager info: Processing logged event: _vs with parameters: {
    "_o" = auto;
    "_pc" = UIViewController;
    "_pi" = "-3988739357756819671";
    "_sc" = "Bubbie.MamboBamboViewController";
    "_si" = "-3988739357756819670";
}
2017-07-27 12:01:09.744 BubbieHuff[77205:6894827] GoogleTagManager info: Processing logged event: show_view with parameters: {
    "_sc" = "Bubbie.MamboBamboViewController";
    "_si" = "-3988739357756819670";
    name = Mambo;
}
like image 968
Rafa de King Avatar asked Jul 27 '17 10:07

Rafa de King


People also ask

How do I disable Google Tag Manager debugging?

Exit preview and debug mode To exit preview mode and stop debugging you can either: Click Disconnect in the floating window on your previewed site. Click the X in the upper left corner of the Tag Assistant debug interface. Click Stop debugging on the Tag Assistant activation page.

How do I disable GTM in Chrome?

In the top-right corner click three dots and then go to More tools > Developer Tools. Then go to Application > Cookies > [Your domain]: And in the search field, enter _TAG_ASSISTANT. Once you find that cookie, click it and hit DELETE on your keyboard.

Can I block Google Tag Manager?

Google Tag Manager Blocker. Prevent yourself from triggering Google Tag Manager on your own website. This extension allows you to block internal traffic from triggering a connection to Google Tag Manager, hence allowing you to avoid corrupting the analytics and events data generated by your website.

How do I disable Google Tag Assistant?

Remove or disable Google Tag AssistantSelect Window > Extensions. Locate the Tag Assistant (by Google) extension. Uncheck the Enabled box to disable the extension. Click the trash icon to delete it.


1 Answers

I just had this problem in a project that combines Google Tag Manager and Firebase. Since no header about logging is exposed I couldn't find a way to turn it off.

This is a monkey patch I came up with that lets you control the info logs from GTM.

+ (void)patchGoogleTagManagerLogging {

    Class class = NSClassFromString(@"TAGLogger");

    SEL originalSelector = NSSelectorFromString(@"info:");
    SEL detourSelector = @selector(detour_info:);

    Method originalMethod = class_getClassMethod(class, originalSelector);
    Method detourMethod = class_getClassMethod([self class], detourSelector);

    class_addMethod(class,
                    detourSelector,
                    method_getImplementation(detourMethod),
                    method_getTypeEncoding(detourMethod));

    method_exchangeImplementations(originalMethod, detourMethod);
}


+ (void)detour_info:(NSString*)message {
    return; // Disable logging
}
like image 180
Scoud Avatar answered Sep 19 '22 13:09

Scoud