Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Thanks for reaching out @sinanisler. The filter you described (googlesitekit_analytics-4_tag_blocked) does still work as intended. Note that this filter is used to disable the Site Kit placed Google Analytics snippet only. Other code snippets may still be placed via AdSense, Tag Manager or other modules. You can apply it by adding the below to a custom functions plugin or your themes functions.php file, ideally a child themes functions.php file so it doesn’t get overwritten with each theme update:

    add_filter( 'googlesitekit_analytics-4_tag_blocked', 'restrict_ga_snippet');
    function restrict_ga_snippet( $original ){
    // don't place snippet on front page
    if ( is_front_page()) {
    return true;
    }
    return false;
    }

    The above will ensure the snippet is not placed on the homepage. You can modify the above to suit your own conditions, such as not placing ads for a particular category or multiple URLs. Let me know if you need further assistance with this.

    Thread Starter sinanisler

    (@sinanisler)

    didnt work just tried it for this page https://wpaimuse.com/campaign/



    add_filter( 'googlesitekit_analytics-4_tag_blocked', 'restrict_ga_snippet');
    function restrict_ga_snippet( $original ){
    if ( is_page(2103)) {
    return true;
    }
    return false;
    }

    check the html source there are still sitekit codes <!– Google Tag Manager snippet added by Site Kit –>

    I double checked everything..

    need working code please.

    Plugin Support James Osborne

    (@jamesosborne)

    @sinanisler If you’re looking to not place the Tag Manager snippet, this differs to the Google Analytics snippet. Please use the below to ensure Site Kit does not place the Tag Manager snippet on the front page of your site. As with the previous snippet, this can be modified to suit your own conditions for other pages:

    add_filter( 'googlesitekit_tag-manager_tag_blocked', 'restrict_gtm_snippet');
    function restrict_gtm_snippet( $original ){
    if ( is_front_page()) {
    return true;
    }
    return false;
    }

    Let me know how you get on with the above.

    Thread Starter sinanisler

    (@sinanisler)

    just tested didnt work

    I need to disable alll the codes loading from sitekit on this page is_page(2103) page id 2103

    do you know any filter hook that disables everything that sitekit loads for a specific page?

    Plugin Support James Osborne

    (@jamesosborne)

    There is no single filter that covers all the snippets that Site Kit places on a users site, although the snippets shared above do work for Google Analytics and Tag Manager. Can you try the below:

    add_filter( 'googlesitekit_tag-manager_tag_blocked', 'restrict_gtm_snippet');
    function restrict_gtm_snippet(){
    if ( $id === 2013) {
    return true;
    }
    return false;
    }

    Let me know how you get on with the above.

    Thread Starter sinanisler

    (@sinanisler)

    tested didnt work

    I am no sure any of your filters works

    I even tested on my other hosting too this scripts not working

    fire up a local xampp or something and test it.

    Plugin Support James Osborne

    (@jamesosborne)

    That’s unfortunate @sinanisler. I did test the filter before before posting although I was testing only by limiting the Google Analytics snippet placed via Site Kit, and the below is working (for a page with the set ID, in my case 1251):

    add_filter( 'googlesitekit_analytics-4_tag_blocked', 'restrict_ga_snippet');
    function restrict_ga_snippet($original){
    if ( is_page(1251)) {
    return true;
    }
    return false;
    }

    Please allow me some time to check for any changes to the tag manager module, which does place a couple of snippets as per this guide.

    • This reply was modified 1 week, 4 days ago by James Osborne. Reason: Update
    Thread Starter sinanisler

    (@sinanisler)

    ok

    if it doesnt exist we need a new filter to disable all scripts.

    please give this feedback to dev.

    Plugin Support James Osborne

    (@jamesosborne)

    Thanks for your patience on this. Can you please try the below:

    add_filter( 'googlesitekit_tagmanager_tag_blocked', 'restrict_gtm_snippet');
    function restrict_gtm_snippet(){
    if ( is_page(2013)) {
    return true;
    }
    return false;
    }

    The difference with the above, is that I referred to the tag manager module as tagmanager as opposed to tag-manager. It’s documented as tag-manager, although I was finding the same results as you. I’ll be performing some further checks on this, but please do try the above and let me know.

    if it doesnt exist we need a new filter to disable all scripts.

    please give this feedback to dev.

    I will certainly pass this one. Thank you! While I can’t guarantee this will be something added to the plugin in the form of a filter or otherwise, feel free to keep an eye out on the plugins GitHub repository, or alternatively you can open your own GitHub issue for this, which the team can review.

    Plugin Support James Osborne

    (@jamesosborne)

    Just to let you know that the correct identifier for tag manager is tagmanager as opposed to tag-manager. Based on this, the last code snippet above should work for your use case. Can you confirm this is working as intended for you?

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.