If I put a link into my posts, I see how many people have clicked on the link. But if I put the link on one line, and it gets one-boxed, then I never see any count of the clicks.
This post describes the issue further:
There are two parts to the answer.
First, you must enable opening links in an external tab. (I don’t understand this, technically, as other links are counted without turning this option on.)
Second…
So, the main link people will click on will never be counted. Again, I don’t understand the technical difference between the links and why one would be counted and not the other.
Regardless of my lack of understanding of what’s going on technically, I’d love to see Onebox link clicks counted consistently.
I have gone through all the settings in my Dashboard and I have no check boxes to enable opening links in an external tab… but the links do open in another tab already.
We have tried clicking on both the title of an article and the link itself - no counter for either.
Here’s a stickler… for a day or two, the counter suddenly worked, then stopped again. Nothing was changed at all. I’ve also asked a mod and several users if they see any link counts next to the links posted. None have seen them so I know it’s not just me being an Admin.
Like you, I would like to see the Onebox link clicks counted consistently.
Edit: I should point out for link posted after a blank space (so they don’t get Oneboxed), the counter works… just not for Onebox.
I already enabled the setting last week, search for default other external links in new tab. This setting will be applied to all new users who have registered on your site after the site setting has been enabled. Old users can activate it from their profiles (in case we can bulk enable the setting even for old users via console).
I tried to click on the two oneboxes in the first two posts of this topic https://forum.nodders.net/t/2019-plastic-waste-and-recycling/167 and the count has increased from 0 to 1. It is possible that the user who did the test was an old user and did not enable the setting for external tab on the profile, or that the user tried to open the link in a new window directly by right-clicking on the link itself.
@dax, @codinghorror, I found out why the link counter was working for me and others on our forum. In _Preferences/Interface/Other, although I did have the Open all external links in another tab checked, I also had the Show counts on browser icon checked. Apparently the latter overrides the first box. I unchecked the Show counts on browser icon, saved, then checked a post… the counter showed up!
I also found one little nuance. When a user posts a link and OneBox tries and fails to OneBox it - leaving the link as is - the link click counter will not work if the link isn’t preceded with a blank space. I just edited a user’s post where this just occurred, adding the space, and the counter began showing.
@dax ¿Tienes alguna idea de por qué se requiere esta configuración para que aparezcan los insignias de clic de onebox? Podría cambiarla para mi sitio, pero para que sea útil, tendría que modificar masivamente la configuración para más de 7400 usuarios, algo que preferiría no hacer, ya que solo causaría confusión.
Tampoco sé por qué te molestarías, ya que los clics en el cuadro único no se contarán de todos modos, excepto para las pocas personas que hacen clic en el enlace menos obvio. Esto significa que, en lugar de no mostrar datos sobre cuántas veces se hizo clic, mostrarás datos incorrectos (artificialmente bajos), lo cual es mucho peor, en mi opinión.
Esto solía funcionar realmente. Los clics en Onebox se contaban en nuestro sitio. Luego, en algún momento, dejó de funcionar. No recuerdo exactamente cuándo, pero creo que fue hace más de un año. Digo que esto es una regresión, no una solicitud real de nueva funcionalidad.
¿Podrías explicar exactamente qué hace tu componente, @evantill?
Simplemente un script que reemplaza un clic en una URL dentro de la onebox por un clic en la URL del encabezado.
// si se hace clic dentro del cuerpo de la onebox
$('.onebox-body a').on('click.onebox-track-url', function(event) {
event.preventDefault(); // -> ignorar el evento de clic dentro de la onebox
var headerUrl = $(event.target).closest('.onebox').find('header a'); // seleccionar la URL del encabezado
// hacer clic en la URL del encabezado en su lugar para actualizar el contador de seguimiento
if (headerUrl.length > 0) {
headerUrl[0].click(); // -> simular clic en la URL del encabezado
}
});
</script>
Una solución podría ser agregar una nueva configuración en onebox para habilitar el seguimiento en los enlaces dentro de oneboxes y, en ese caso, añadir la clase track-link a los enlaces dentro de oneboxes.
No me queda claro en este hilo si fue una decisión intencional dejar de rastrear los clics en onebox o si se trata simplemente de un error por el que podrías crear un pull request.
¿Sería correcto describir la corrección propuesta de la siguiente manera?
“Si el enlace está en el cuerpo de un onebox, busca la URL del onebox. Si esa URL es la misma que la del enlace, cuenta el clic. De lo contrario, ignóralo.”