Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1065703
    garethmorgannz
    Participant

    Hi,

    I realise this is pretty custom work but I am having huge issues getting a jquery script to fire in xtheme. I am following this tutorial to help measure engagement in google analytics http://www.lunametrics.com/blog/2014/01/24/classify-blog-posts-analytics-content-groupings/

    I have successfully implemented this is other wordpress and joomla sites, but can’t get it working in X theme. I have tried multiple selectors with no luck. Out of the tutorial the only marcro that works is #4. All others just send a response of “Undefined”

    This is really cool stuff and I am sure there will be other X members who would love to get this working.

    Site in questions is http://morganfoundation.org.nz. I can make a video if further explanation is required

    Thanks for the help

    #1066172
    Lely
    Moderator

    Hello There,

    We do have X – Google Analytics wherein you can add analytics code. Can you check that? Or to help you better, please clarify what code you want to add and where exactly so we can be specific on our suggestion.

    #1067379
    garethmorgannz
    Participant

    If you have a look at the luna metrics blog you will see what I am trying to achieve

    Basically the issue is the jquery below is not outputting a when using X, irrespective of what css selector I try and use

    function() {
    var wordCountTemp = $(“#content”).text();
    wordCountTemp = wordCountTemp.replace(/(^\s*)|(\s*$)/gi,””);
    wordCountTemp = wordCountTemp.replace(/[ ]{2,}/gi,” “);
    wordCountTemp = wordCountTemp.replace(/\n /,”\n”);
    var wordCount = wordCountTemp.split(‘ ‘).length;
    if (wordCount>3000) return “3k+”;
    else if (wordCount>2500) return “2.5k-3k”;
    else if (wordCount>2000) return “2k-2.5k”;
    else if (wordCount>1500) return “1.5k-2k”;
    else if (wordCount>1100) return “1.1k-1.5k”;
    else if (wordCount>800) return “800-1.1k”;
    else if (wordCount>500) return “500-800”;
    else if (wordCount>200) return “200-500”;
    else return “<200”;
    }

    If you need more detail let me know and I will make a quick video

    #1067944
    Rad
    Moderator

    Hi there,

    Thanks for writing in.

    Sure, please provide a video recording.

    For the meantime, please remove the embed code (addthis sharing) from your customizer’s custom javascript. It’s for javascript, and an embed code is mixed of both HTML and Javascript.

    Thanks!

  • <script> jQuery(function($){ $("#no-reply-1065703 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>