Support » Plugin: Flying Analytics by WP Speed Matters » Events not Being Tracked

  • Resolved Sim Architect

    (@thesimarchitect)


    Hi! I’d like to track an on click event at the page linked above. I found out that your plugin does a fantastic job speeding up the site and improving speed scores, but for a very few specific pages I’d like to be able to load the code below, unchanged by your Flying Analytics, so I can have normal event tracking on that specific page only (I might have a couple of other events on other specific pages, but that’s what I need, no need to load the entire gtag anywhere else):

    <!– Global site tag (gtag.js) – Google Analytics –>
    <script async src=”https://www.googletagmanager.com/gtag/js?id=PROPERTYNUMBER”></script&gt;
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());

    gtag(‘config’, ‘PROPERTYNUMBER’);
    </script>

    How can I make it happen? Thanks!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Gijo Varghese

    (@gijo)

    @thesimarchitect Flying Analytics only inject the JS file. You will need to add a separate JS code to track events. Depends on which method you choose in Flying Analytics.

    If you’ve choosen ‘gtag’, try adding the following code alone:

    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag(‘js’, new Date());
    
    gtag(‘config’, ‘PROPERTYNUMBER’);
    </script>
    Thread Starter Sim Architect

    (@thesimarchitect)

    Thank you so much for your prompt reply!

    I use Minimal Analytics Inlined, since it gives me a way better score and it’s more than enough for most pages.

    Sadly your solution did not work, neither the one I posted right above.

    I tried the snippet both on head and on body, no luck.

    This is the event I am tracking:

    <a id="link" style="display:none; font-size: calc(min(3.2vw, 42px));" rel="noreferrer noopener nofollow" target="_blank" onclick="ga('send', 'event', 'External Link', 'Click', 'Decoded Link');" class="sg-confirm-popup-2809">⏩ Click here to continue ⏩</a>

    I am surely doing something wrong, sorry for being such a noob 🤦🏻‍♂️

    Plugin Author Gijo Varghese

    (@gijo)

    @thesimarchitect sending events has different code for Minimal Analytics. See the docs: https://minimalanalytics.com/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Events not Being Tracked’ is closed to new replies.