• Resolved PJ

    (@twothirty)


    Fathom Analytics is a single line of JS code, like this:

    <script src="https://cdn.usefathom.com/script.js" data-site="ABCDEFG" defer></script>

    When you turn on SGO JS minification or combination it takes that script above and puts it in an SGO JS file. The problem is, that then breaks the Fathom script from working, as the data-site=”” is stripped out.

    There’s no way to exclude the above script either as nothing is found in the SGO Javascript exclude for the above script.

    So there’s no way to use Fathom Analytics for website analytics and the SGO plugin.

    Can this be addressed or resolved?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Dimo Dimov

    (@dimodi)

    Hello @twothirty,

    If the affected script is not present in the drop-down list, you may try to exclude it using one of the filters we’ve created for that purpose. More information on how to do that can be found in the official plugin documentation or in this thread:

    https://wordpress.org/support/topic/how-to-use-sg-optimizers-filters-procedure/

    Best regards,
    Dimo

    Thread Starter PJ

    (@twothirty)

    Hi Dimo, is there no better solution or solution you’re working that doesn’t involve our customers having to install another program and edit code?

    Plugin Support Dimo Dimov

    (@dimodi)

    If the affected script is not present in the drop-down list then the only way to exclude it is to add the mentioned filter manually. The filters are usually added to the functions.php file of the currently active theme.

    If this is not a suitable option the alternative would be to leave the JS minification disabled and still take advantage of the rest of the features offered by our plugin.

    Best regards,
    Dimo

    Thread Starter PJ

    (@twothirty)

    Unfortnately https://wordpress.org/support/topic/how-to-use-sg-optimizers-filters-procedure/ doesn’t work as it doesn’t add a handle or data-handle to the Fathom script.

    Any other ideas or suggestions?

    Plugin Support Plamen M

    (@plamenm)

    Hello @twothirty ,

    Your alternative is to directly contact the developers of Fathom Analytics and have them provide you with the handler of the script.

    Then, add it as explained in the article: https://wordpress.org/support/topic/how-to-use-sg-optimizers-filters-procedure/

    Regards,
    Plamen.M
    Tech Support Team
    SiteGround.com

    Thread Starter PJ

    (@twothirty)

    I’m actually the cofounder of Fathom 🙂

    We don’t have a handler on our script. It’s never been needed, and I don’t want to add extra code to our script just so your plugin doesn’t break ours. Right?

    We share a lot of customers, I was just hoping there was an easy solution for our shared customers to use both our products. Folks use our software because it’s a single line of code and works with every CMS, framework, etc. So we’re just looking for a solution that’s easy for them to use SGO as well with Fathom.

    Plugin Support Pavel Dosev

    (@pdosev)


    Hello @twothirty,

    We primarily use handlers to detect and provide an option for exclusion from our optimization.

    If you don’t want to add a handler to the script, you can use the exclude by domain option, which is unavailable on the SG-Optimiser interface.

    Still, we provide other options for excluding scripts from the JS optimization. You can exclude the script from JS optimization by adding the code below to a site’s active theme functions.php file:

    add_filter( 'sgo_javascript_combine_excluded_external_paths', 'js_combine_exclude_external_script' );
    function js_combine_exclude_external_script( $exclude_list ) {
        $exclude_list[] = 'cdn.usefathom.com';
    
        return $exclude_list;
    }
    Thread Starter PJ

    (@twothirty)

    Ok, thank you Pavel, that’s actually quite helpful and I can package that into a JSON file our customers can import into the Code Snippets plugin.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘SGO breaks Fathom Analytics’ is closed to new replies.