Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

290
Views
¿Hay una devolución de llamada para el botón Tweet de Twitter?

¿Hay alguna forma de registrar una devolución de llamada en el botón Tweet de Twitter? Me gustaría poder rastrear qué usuarios particulares en mi sitio han twitteado un enlace. No puedo agregar el evento onClick porque es un iFrame entre dominios. ¿Alguna otra idea?

He visto una forma de hacerlo, pero parece poco fiable. Su documentación no menciona nada, así que estoy buscando ayuda con una solución alternativa.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Twitter tiene eventos Web Intent para loaded , rendered , resize el tamaño, tweet , follow , retweet , dar me like y click .

 twttr.events.bind( 'tweet', function (event) { // Do something there } );

El comportamiento se modificó en el otoño de 2015 debido a la falta de confiabilidad de las devoluciones de llamadas que ocurren después de que se completa un evento.

Ahora se activarán cuando un usuario invoque la acción en su página, en lugar de después de que se complete la acción.

Ejemplo cargando widgets.js :

 <script> // Performant asynchronous method of loading widgets.js window.twttr = (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], t = window.twttr || {}; if (d.getElementById(id)) return t; js = d.createElement(s); js.id = id; js.src = "https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); t._e = []; t.ready = function(f) { t._e.push(f); }; return t; }(document, "script", "twitter-wjs")); </script> <script> // Wait until twttr to be ready before adding event listeners twttr.ready(function (twttr) { twttr.events.bind('tweet', function(event) { console.log(event); }); }); </script>
over 4 years ago · Santiago Trujillo Report

0

Acabo de implementar un evento de devolución de llamada de tweet.

Más información sobre el evento de devolución de llamada de Twitter
- Intentos web de Twitter
- Eventos de Javascript de Web Intents

La devolución de llamada de Javascript

 $.getScript("http://platform.twitter.com/widgets.js", function(){ function handleTweetEvent(event){ if (event) { alert("This is a callback from a tweet") } } twttr.events.bind('tweet', handleTweetEvent); });

El botón de twittear:

 <a href="http://twitter.com/intent/tweet?url=http://test.com;via=stack">twitter</a>
over 4 years ago · Santiago Trujillo Report

0

Si carga Twitter Widgets JS, puede vincular una función de devolución de llamada al evento de tweet. Vea el código a continuación:

 <a href="https://twitter.com/intent/tweet?url=http://yoursite.com/about&text=Message">Twitter</a> <script> //Twitter Widgets JS window.twttr = (function (d,s,id) { var t, js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js=d.createElement(s); js.id=id; js.src="https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs); return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } }); }(document, "script", "twitter-wjs")); //Once twttr is ready, bind a callback function to the tweet event twttr.ready(function(twttr) { twttr.events.bind('tweet', function (event) { console.log('tweet, tweet'); }); }); </script>
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!