Git Product home page Git Product logo

Comments (14)

duracelltomi avatar duracelltomi commented on July 17, 2024 1

... or we could just use wp-admin/js/word-count.js

from gtm4wp.

duracelltomi avatar duracelltomi commented on July 17, 2024 1

No, it has been not merged yet, I want to finish the next version shortly.

Due to covid and being a bit more tired at work, I was adding more vacation and time with my family but I intend to speed up things in the coming weeks

from gtm4wp.

koconder avatar koconder commented on July 17, 2024

@ju1 might look into this, will see how it affects speed/rendering first. Also in regards to "ranges" this should be handled in the analytics platform (via calculated dimensions) or the tag manager to keep it clean, as ranges might differ for users needs.

from gtm4wp.

ju1 avatar ju1 commented on July 17, 2024

Thanks for the update. And that's a good idea to calculate ranges on our own.

from gtm4wp.

tijevlam avatar tijevlam commented on July 17, 2024

Wouldn't it make more sense to calculate the word count directly in GTM? Thats easy with a simple javascript and gives you a lot of control on which sections of content you would like to include in the wordcount.

from gtm4wp.

duracelltomi avatar duracelltomi commented on July 17, 2024

@tijevlam the main purpose of this plugin is to add features which would normally need JS codes inside your GTM container. Having the word count was requested many times I just do not see whether this can be implemented without affecting page load performance on sites with heavy traffic.

But since we are talking about an option that could be disabled on those sites, I would be happy to have this in the plugin. My guess is that there must be some ready made codes on the net which we could include (also legally) instead of writing our own code.

from gtm4wp.

koconder avatar koconder commented on July 17, 2024

@duracelltomi i have a simple working solution that uses the WP_Query loop. Will add in once the other PR's are cleared so we don't have too many conflicting changes. If there is no harm on performance we can add it in, if there is we can decide if to include with any warnings.

from gtm4wp.

duracelltomi avatar duracelltomi commented on July 17, 2024

Thanks! Two PRs still needs some change as far as I can see but both are very close to be merged i guess :-)

In my experience adding a warning is always the best way: WordPress can be running on various servers with lots of plugins, there will be always cases where such an algorithm will degrade performance.

from gtm4wp.

tijevlam avatar tijevlam commented on July 17, 2024

@duracelltomi i see your purpose with the plugin. I'm mostly fan of the option to include variables that are available only or more easily on the server side of things.

I agree it would come in handy when the wordcount would be available straight from this plugin. However, I don't think this should have a significant effect on performance.

I'm eager to see how your solution works @koconder. I've seen some specific wordcount plugins for WP, they all save the wordcount in a new table (or column) in the posts-table. Which would bea great effect solution performancewise i'd say, but would mean a lot of extra implications for this plugin.

Adding to the wordcount, from a analytist-perspective: I'd suggest we also add imageCount and videoCount. I've made reports and analysis in the past that exposed a real cohersion between reads, scroll depths and number of images/media.

from gtm4wp.

duracelltomi avatar duracelltomi commented on July 17, 2024

having the word count cached in post_meta would be a good idea to minimize impact on performance - but we need to prepare a code that will store this for already existing posts - I guess this can be done while a post is being viewed by a visitor as this would only affect this one page load perhaps

from gtm4wp.

duracelltomi avatar duracelltomi commented on July 17, 2024

I wonder if this can be done just by using str_word_count()

Perhaps a cleaning would be necessary first:
https://plugins.trac.wordpress.org/browser/wp-word-count/trunk/includes/class-wpwc-functions.php#L56

I wonder if apply_filters() with 'the_content' would be also needed before counting the words?

from gtm4wp.

camassey avatar camassey commented on July 17, 2024

Hi @duracelltomi - am I right in thinking this hasn't been merge / released yet? Is there (currently) any plan to?

from gtm4wp.

koconder avatar koconder commented on July 17, 2024

@duracelltomi my original suggestion was to bake in support for 3rd party word count plugins, and just read data via post_meta into dataLayer which would be easier to support and maintain. As some sites/themes/plugins could have differences in word count and would be better to focus on pulling in data rather than trying to calculate ourselves.

from gtm4wp.

Paktas avatar Paktas commented on July 17, 2024

Each plugin has a slightly different way of counting words. If you embedd content - some fail to recognise HTML, some do, some regard fullstop (.) as word delimiter when it's just a decimal.
Would be best to use some methodology that is at the core of WP to nativelly count words.

from gtm4wp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.