vincepare / iframetracker-jquery Goto Github PK
View Code? Open in Web Editor NEWjQuery Plugin to track click on iframes (like Google Adsense or Facebook Like button)
License: Apache License 2.0
jQuery Plugin to track click on iframes (like Google Adsense or Facebook Like button)
License: Apache License 2.0
super neat!
If you have a rich text (contentEditable iframe) editor that is not tracked, and you load the iframe tracker, every time you move your mouse out of the text editor, it blurs it, because your mousemove listener is applied globally
wat
Hi,
Does not detect Adsense ads in Firefox. Are you planning to update in next date?
It looks like IE11 (maybe other versions too) sometimes leaves document.activeElement undefined - this one line patch lets the mousmove() handler deal with that:
p4diff .\src\main\webapp\js\lib\jquery.iframetracker.js
==== //optimost/author/trunk_skynet/WebApp/src/main/webapp/js/lib/jquery.iframetracker.js#1 - C:\Users\pasquire\Perforce
\p4cg\optimost\author\trunk_skynet\WebApp\src\main\webapp\js\lib\jquery.iframetracker.js ====
@@ -56,7 +56,7 @@
this.focusRetriever = $('#focus_retriever');
this.focusRetrieved = false;
$(document).mousemove(function(e){ // Focus back to page
if( document.activeElement.tagName == 'IFRAME' ){
if( document.activeElement && (document.activeElement.tagName == 'IFRAME') ){ $.iframeTracker.focusRetriever.focus(); $.iframeTracker.focusRetrieved = true; }
My problem - enspect how to count clicks on adsense banners on my site (http://help-me-now.ru/)
I use plugin iframeTracker and write that code:
jQuery(document).ready(function(){
jQuery('.adsbygoogle iframe').iframeTracker({
blurCallback: function(){
console.log('YYY');
}
});
});
But, after click on banners - console not showing 'YYY' in log. Why?
Hi i really love this plugin how it works and the idea of how it takes care of the problem but there is a little problem which it is not with other iframes but the google adsense.
My code is like this:
$('#ads iframe').iframeTracker({
blurCallback: function(){
// Do something when the iframe is clicked (like firing an XHR request)
$.cookie.json = true;
$.cookie('ads', 'clicked', { expires: 2, path: '/' });
}
});
This does not save the cookie when i click in iframe I tried the same with the youtube player when I click play it does work just not with the google adsense iframe. Is there something that I'm missing ?
Can you determine a license for your plug-in, please?
Hi,
Thanks for the great script! I'm having a small issue that the click tracker only works once.
So I mouse in and click and it works (I actually open a menu at this point). But then when the menu is closed and a user clicks again in the iframe nothing happens (working with vid embeds here).
The problem is that blurCallback is not called. I need to mouse out of the iframe and mouse back to make blurCallback fire again on click.
I feel its prob an easy fix but haven't found it yet. Any pointers would be appreciated!
Thanks.
P.s. from reading the tutorial etc I thought '$(window).focus();' would reset it and catch the click but it doesn't :(
I just want to capture anchor clicks in the iframe and get the href attribute from anchor.
Hi,
I want to know that, is this plugin work with python selenium to click on google ads?
if yes then how can i used with selenium with python.
Can iframeTracker be used to close adsense or DFP ads when user is swiping over the iframes? An step-by-step would be greatly appreciated.
Thanks!
First of all, thanks for this excellent plugin. It works like a charm in most of cases and has really saved me from big pain.
I am facing problem when two iframes overlap each other. In this case, if mouse moves from iframe#1 to iframe#2 such that it does not go to parent body in that case, clicks are not getting logged.
In image above, if you click on Blue Area, then notification comes. Now if you move mouse to red area without taking mouse to parent body and then click on red area then no popup is shown.
Can you please suggest a way to solve this problem.
Thanks in advance.
Gaurav
I use your plugin for click on the frame. but I want to know click on which element such az button. please help me.
Hi!
Is it possible, to track a second, third, and so on click inside the iframe? (without leaving it)
Thank you and best,
Otto
when user input, mouse does't move, but text box will lost focus, maybe due to input method, but how can i fix this by filtering input or textarea element
Hey @vincepare,
How could I do to disable right clicks on the iframe not be counted iframetracker?
thanks for all
With many empiric tests I've found out that if the mouse pointer is in the iframe area by the time document ready is triggered, all the clicks in the iframe won't get tracked.
In Chrome this doesn't happen, i.e. the clicks are still tracked.
At first glance this has to do with peculiarities of how a browser triggers windows blur, but it would be great to find a way to circumnvent this limitation.
In IE7/IE8 with jQuery 1.11.0 you cannot enter text in inputs created after document ready.
If you click in such an input, it will lose focus immeditely.
Suggested fix: change line 77 to
$('body').on('click', 'form', function(e){ e.stopPropagation(); });
I was dubbing and using alert to check the blurCallback. My Iframe normally opens an external url. When I use Alert() it stops excuting the Iframe event. I don't know why?!!
$('#myFrame').iframeTracker({ blurCallback: function () { alert('show'); } });
I'm using chrome Version 50.0.2661.66 beta-m (64-bit)
iframeTracker seems to be throwing security errors in Google Chrome.
I'm wondering if it would work to have a 0margin, 0 padding wrapper and detect mouseover and blur on the wrapper rather than the iframe element.
Normally my Iframe contains links. I want to catch the Iframe click event (which will open an external link) to show a message to user before opening the link.
$('#myFrame').iframeTracker({ blurCallback: function () { $('#WelcomeMessage').modal('show'); } });
The Iframe event always triggers before showing the message.
I'm using Version 50.0.2661.66 beta-m (64-bit)
Hi, I am using this in Google Tag manager, and it is triggering, however, I do not have iframes with ids, so if a user clicks on an iframe I want to get the src of the iframe.
In GTM my code looks like the following. How can I access the iframe src in the callback function?
function(){
$('iframe').iframeTracker({
blurCallback: function(){
//how can I get the iframe src in here?
}
});
}
Hi this plugin is not working on iphone progressive app, how i can fix?
iframeTracker is great.
iframeTracker works good on desktop browsers, but I tested it on Opera Mobile Classic Emulator, it doesn't work.
http://www.opera.com/developer/mobile-emulator
Is there any solution?
Hello, given that I have subscribed to some iframes with:
$('iframe.youtube').iframeTracker({
blurCallback: function(){
console.info('youtube');
}
});
What's now the recommended way to unsubscribe from clicks on these iframes?
The insertion of the text input element causes the keyboard to briefly appear when changing focus. Adding readonly="true"
to the input field fixes this without breaking the event handling in my limited testing.
The event gets fired just by mouse down inside the iframe.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.