• Resolved joaodath

    (@onetimelord)


    I’m working on CSP and from Tag Manager docs, it looks like the preferred method of using Tag Manager with CSP is to implement a nonce. I understand this may fall under “Advanced Users” or similar, but is there anyway SiteKit could add the nonce since it implements Tag Manager for the user? If not through the interface, maybe through a hook so developers can use it (eg. plugins like GD Security Headers)?

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

    (@jamesosborne)

    Thanks for getting in touch @onetimelord. Based on your suggestion, I went ahead and created a GitHub issue on the plugins GitHub repository which you’ll find below:
    https://github.com/google/site-kit-wp/issues/9574

    The team periodically review such feature requests before deciding what to proceed with. Feel free to subscribe to that issue for updates, or chime in with any additional input.

    Regarding any way to add any nonce values when using Site Kit at present, we do have a filter that can be used to add any data attributes to the Site Kit placed Tag Manager code, however, this doesn’t insert additional code that is requested as per this guide. For that reason, I would recommend adding your Tag Manager code manually, or defining a CSP policy via other means.

    Let me know if you have any questions with the above, and thank you for the suggestion.

    Thread Starter joaodath

    (@onetimelord)

    Thanks, @jamesosborne! I’ll keep an eye out for this feature. In the meantime, could you point me to where I can get more info on the filters available for Site Kit?

    Plugin Support James Osborne

    (@jamesosborne)

    @onetimelord You’ll see details of one such filter over on the plugins GitHub repository. One of the filters to add options to the gtag snippet placed via Site Kit is googlesitekit_gtag_opt. Any example of it’s usage is below:

    add_filter(
    'googlesitekit_gtag_opt',function( array $options ) {
    $options['my_field'] = 'somevalue';
    return $options;
    }
    );

    I’ll also make the team aware of the GitHub issue we raised. Thank you.

    Plugin Support James Osborne

    (@jamesosborne)

    Just to let you know that the filter I shared above it more applicable to a Site Kit placed Analytics snippet. Please keep an eye on that GitHub issue we created based on your support topic, for any future updates. I can’t guarantee there will be changes made to the plugin to account for this, but any updates going forward will be added to that issue. Thank you!

    Thread Starter joaodath

    (@onetimelord)

    Hey! Thanks! I’ll watch the issue closely!

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