GithubHelp home page GithubHelp logo

vincepare / iframetracker-jquery Goto Github PK

View Code? Open in Web Editor NEW
240.0 240.0 107.0 61 KB

jQuery Plugin to track click on iframes (like Google Adsense or Facebook Like button)

License: Apache License 2.0

JavaScript 80.84% HTML 19.16%

iframetracker-jquery's People

Contributors

finalclap avatar vincepare avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iframetracker-jquery's Issues

Tracker clobbers focus of any iframe on the page

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

Firefox - Not detected for Adsense

Hi,

Does not detect Adsense ads in Firefox. Are you planning to update in next date?

  • Firefox (Not detected)
  • Brave (sometimes)
  • Chrome
  • Edge (sometimes)

small fix for IE11

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;
                            }
    

Adsense click does not take action

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 ?

License

Can you determine a license for your plug-in, please?

Click tracking only works on first click

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 :(

Click on Google Ads with Selenium

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.

Plugin does not work with overlapping iframes

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.

screenshot from 2014-02-03 11 17 07

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

Firefox - click not detected if pointer is in iFrame before document ready

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.

Ajax loaded forms IE7/IE8

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(); });

Alert stops the Iframe event

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)

Not working in Chrome

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.

can't do any DOM manipulation before fingering the Ifram event

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)

Get closest iframe src using tracker

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?
    }
  });
}

How to unsubscribe from iframeTracker?

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?

Plugin sometimes causes iOS keyboard to display

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.

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.