Comments (14)
... or we could just use wp-admin/js/word-count.js
from gtm4wp.
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.
@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.
Thanks for the update. And that's a good idea to calculate ranges on our own.
from gtm4wp.
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.
@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.
@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.
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.
@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.
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.
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.
Hi @duracelltomi - am I right in thinking this hasn't been merge / released yet? Is there (currently) any plan to?
from gtm4wp.
@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.
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)
- User data for Enhanced Ecommerce HOT 4
- Problem with the "purchase" event HOT 17
- Enhanced conversion email/phone prepping before hashing HOT 10
- Google Tag Manager is loaded even though setting is turned off HOT 12
- String vs id in view_item_details HOT 8
- Uncaught TypeError: Cannot read properties of null (reading 'scrollTop') HOT 2
- view_item only active if variations selected HOT 5
- EVENT PURCHASE DON'T FIRE ON LINK ORDER PAY WOOCOMMERCE HOT 24
- Add Custom Fields to datalayer HOT 8
- Clicking on a product only loads browser after 2-3 secondes. HOT 5
- DataLayer BUG in variable product HOT 7
- PHP Deprecated: Creation of dynamic property WhichBrowser\\Analyser\\Header\\Useragent::$data is deprecated HOT 1
- WebToffee plugin integration consent denied update HOT 1
- FacebookPixel template not working HOT 4
- Problem with random products in add to cart HOT 4
- Plugin blocks Link-Clicks HOT 3
- DataLayer not compliant with Google specifications. HOT 2
- GTM4WP - Category product links take seconds to open HOT 2
- add to cart doesn't fire HOT 1
- How to add nonce for CSP? gtm4wp_get_the_gtm_tag filter is deprecated. HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gtm4wp.