• Hey,
    First of all, I have very little to none knowledge of wordpress and php.

    What I am trying to do, is to use event tracking so see if people press the read more heading on the home page to read news and devlogs.

    I’m using the class and not ID and setting it like this: <?php $moreText = '<h2 class="btn' . str_replace(" ","_",get_the_category($post_id)[0]->name) . '">Read More</h2>'; //print $moreText; ?>

    The two current categories are Devlog and News, so the class name becomes btnDevlog and btnNews.

    When I inspect the heading in the browser, the class name is correct and match what I wrote in the WP GA events click tracking. But nothing shows up in Google Analytics.

    Can anyone help me getting the data to google analytics?

    Additional info:
    – We are using MonsterInsight light to implement google analytics but the light version does not include event tracking.
    – I have done nothing on Google Analytics besides coping the GA tracking code.

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

Viewing 13 replies - 1 through 13 (of 13 total)
  • Anyone able to help? It would be much appreciated!

    Plugin Author yuvalo

    (@yuvalo)

    hi @joped

    What you need to do is configure a Click Tracking event, where the element name is the class, and the type is class. The content of the rest of the fields, category, action, and label, is up to you.

    Because you are using MonsterInsight, check the “Don’t include the GA code snippet” option.

    There is something that is bothering me – While the js file we use is included on your page, the code that we add to each page doesn’t.
    Are you using a caching plugin?

    Yuval

    Hi,
    Sorry about not clearing that up. I actually did do that part. In the following link the image shows how I set it up, https://imgur.com/a/KoljI

    I don’t think we have any caching plugin but, I didn’t set up the website.
    I can’t see any caching plugin on the list of plugins, so I guess not.

    Actually are you sure I need to untick the “Don’t include the GA code snippet”, because the light version of MonsterInsights does not support click/event tracking.

    Btw, the btn prefix for class names, has been replaced with read.

    Plugin Author yuvalo

    (@yuvalo)

    The problem is that the plugin code is missing from the page.
    We add the code to the footer section and on your site, it is not there for some reason.
    Can you tell me which theme you are using?

    Yuval

    We use a custom theme.

    Plugin Author yuvalo

    (@yuvalo)

    We use the wp_footer action which adds the code before the </body> tag.
    It is possible that your theme is not calling the wp_footer() function.

    Yuval

    That is possible.

    Where would I call that method and how. I’m still learning php and the wordpress setup.

    Plugin Author yuvalo

    (@yuvalo)

    It’s usually called in the footer file just above the </body> section.
    The best way to see examples is looking at the built-in themes like – https://www.ads-software.com/themes/twentyseventeen/

    Yuval

    You are now officially my hero!!

    It totally worked, and fixed a problem I had with a cookie plugin.

    Plugin Author yuvalo

    (@yuvalo)

    happy it worked out.
    Good luck with the game – followed you on twitch.

    Well thank you. Sorry about the immediate lack to streaming, but we didn’t quite have the time to do it.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Event tracking not working’ is closed to new replies.