A Google Analytics plugin for measuring Vimeo Player Events. The plugin supports Universal Analytics, Classic Google Analytics, and Google Tag Manager.

Usage

Include the scripts in the body section of the HTML document, just before the tag. You’ll need to be running on a web server instead of opening the file directly in your browser. Flash and JS security restrictions will prevent the API from working when run locally.

Basic event trackers

  • Category: Vimeo
  • Action:
    • Started video: when the video starts playing.
    • Paused video: when the video is paused.
    • Resumed video: when the video starts playing when it was paused.
    • Completed video: when the video reaches 100% completion.
    • Skipped video: when the video is skipped forward or backward.
  • Label: URL and name (optional) of embedded video on Vimeo.

Module name: Google Analytics Vimeo

Sandbox project page: https://www.drupal.org/sandbox/arun/2545154

Git repository: branch 7.x-1.x

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/ARUN/2545154.git google_analytics_vimeo

Setting Repository:

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/ARUN/2545154.git google_analytics_vimeo
cd google_analytics_vimeo

PAReview: http://pareview.sh/pareview/httpgitdrupalorgsandboxarun2545154git

Manual reviews of other projects:

Comments

ARUN AK created an issue. See original summary.

PA robot’s picture

Multiple Applications
It appears that there have been multiple project applications opened under your username:

Project 1: https://www.drupal.org/node/2545934

Project 2: https://www.drupal.org/node/2542176

As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).

If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.

I'm a robot and this is an automated message from Project Applications Scraper.

PA robot’s picture

Issue summary: View changes

Fixed the git clone URL in the issue summary for non-maintainer users.

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

arun ak’s picture

Issue summary: View changes
arun ak’s picture

Issue tags: +PAreview: review bonus

Added manual review links for review bonus tag.

arun ak’s picture

Issue summary: View changes
arun ak’s picture

Issue summary: View changes
ajalan065’s picture

Status: Needs review » Needs work

Hi ARUN AK,
1. There is no need of so many blank lines in between the tags in the *.info file. Just leave an extra line at the end of the file.
2. Get the path to library by libraries_get_path('library') instead of hardcoded path(sites/all/libraries) in the *.module file as well as *.install file.
3. We generally do not code the js in the *.module file itself. So it is recommended that you move the entire code

 drupal_add_js(array('googleanalytics_vimeo' => array('progress25' => variable_get('googleanalytics_vimeo_progress25', FALSE))), array('type' => 'setting'));
  drupal_add_js(array('googleanalytics_vimeo' => array('progress50' => variable_get('googleanalytics_vimeo_progress50', FALSE))), array('type' => 'setting'));
  drupal_add_js(array('googleanalytics_vimeo' => array('progress75' => variable_get('googleanalytics_vimeo_progress75', FALSE))), array('type' => 'setting'));
  drupal_add_js(array('googleanalytics_vimeo' => array('videoPlayed' => variable_get('googleanalytics_vimeo_videoPlayed', FALSE))), array('type' => 'setting'));
  drupal_add_js(array('googleanalytics_vimeo' => array('videoPaused' => variable_get('googleanalytics_vimeo_videoPaused', FALSE))), array('type' => 'setting'));
  drupal_add_js(array('googleanalytics_vimeo' => array('videoResumed' => variable_get('googleanalytics_vimeo_videoResumed', FALSE))), array('type' => 'setting'));
  drupal_add_js(array('googleanalytics_vimeo' => array('videoSeeking' => variable_get('googleanalytics_vimeo_videoSeeking', FALSE))), array('type' => 'setting'));
  drupal_add_js(array('googleanalytics_vimeo' => array('videoCompleted' => variable_get('googleanalytics_vimeo_videoCompleted', FALSE))), array('type' => 'setting'));

to a separate place, and access it here instead.
4. It is better to use current_path() instead of $_GET['q']. Please make changes in your *.module for the same.

arun ak’s picture

Status: Needs work » Needs review

Hi ajalan065,

Thanks for your comments. Fixed all the issues mentioned in your comment. Please check and verify.

1. Blank space removed from *.info file.
2. replaced "sites/all/libraries" with libraries_get_path('vimeo.ga.js').
3. Moved all js code in to separate inc file.
5. Replaced $_GET['q'] with drupal's current_path() function.

Thanks,
ARUN AK

arun ak’s picture

Issue summary: View changes
arun ak’s picture

Issue summary: View changes
gauravsood91’s picture

Manual Review

Individual user account
Yes: Follows guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements
Coding style & Drupal API usage
Meets coding style and api guidelines

arun ak’s picture

Hi gaurav/ajalan065,

Did you get a chance to check the functionality of this module? I mean how this module tracking different Vimeo player events.

larowlan’s picture

Couple of observations
drupal_add_js(drupal_get_path('module', 'googleanalytics_vimeo') . '/googleanalytics_vimeo.js', array('scope' => 'footer')); - would it still work if you used $page['#attached']['js'][] = here?
Would make d8 upgrade easier and would be cache-safe.

Ingoogleanalytics_vimeo_settings() you could use '#type' => 'checkboxes' for 'googleanalytics_vimeo_tracking_options' and simplify the code.

In the admin code $visibility == 2 this would best be served with a constant, for readability (2 seems magic).

Are you totally wedded to supporting php.module and php based visibility? If so, you should try an integrate with paranoia module. If you can live without it, I'd remove it - one less vector.

In googleanalytics_vimeo_admin_config_js you can add this in one call to drupal_add_js, just build a keyed array.

In the JavaScript you loop over $.each(vimeo_iframes, function (index, iframe) twice - can this be combined into a single pass?

I note also you use vimeo_iframes = $('iframe'); could you not use vimeo_iframes = $('iframe[src*=player.vimeo.com]'); and filter the result from the onset?

Other than these observations - this looks well coded and care has been taken with the module - thank you for contributing to Drupal.

arun ak’s picture

Hi larowlan,

I worked on the issues you mentioned above. Please see my comments below:

1) drupal_add_js() replaced with ['#attached']['js'][].

2) Changed field type in to 'checkboxes' instead of 'checkbox' for 'googleanalytics_vimeo_tracking_options' and simplified the code.

3) replaced 2 with constant GOOGLEANALYTICS_VIMEO_USE_PHP_FOR_TRACKING.

4) I have integrated paranonia module with the code. Implemented hook_paranoia_hide_permissions().

5) Created a keyed array in drupal_add_js() instead of calling multiple times in googleanalytics_vimeo_admin_config_js().

6) Removed multiple $.each from javascript code and code combined.

7) Replaced vimeo_iframes = $('iframe'); with vimeo_iframes = $('iframe[src*="player.vimeo.com"]'); in js file and simplified the code.

Thanks,
ARUN AK

arun ak’s picture

Issue summary: View changes

Added one more manual review link to prioritize the application.

arun ak’s picture

Priority: Normal » Major
arun ak’s picture

Priority: Major » Critical
klausi’s picture

Priority: Critical » Normal
Status: Needs review » Needs work
Issue tags: +PAreview: security

Review of the 7.x-1.x branch (commit fa137a1):

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    FILE: /home/klausi/pareview_temp/googleanalytics_vimeo.inc
    ---------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ---------------------------------------------------------------------------
     13 | ERROR | [x] Array indentation error, expected 4 spaces but found 6
     23 | ERROR | [x] Array closing indentation error, expected 2 spaces but
        |       |     found 4
    ---------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ---------------------------------------------------------------------------
    
  • ESLint has found some issues with your code (please check the JavaScript coding standards).
/home/klausi/pareview_temp/googleanalytics_vimeo.js: line 33, col 7, Error - "vimeoGAJS" is not defined. (no-undef)
/home/klausi/pareview_temp/googleanalytics_vimeo.js: line 34, col 14, Error - "vimeoGAJS" is not defined. (no-undef)

2 problems
  • DrupalPractice has found some issues with your code, but could be false positives.
    FILE: /home/klausi/pareview_temp/googleanalytics_vimeo.module
    ---------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    ---------------------------------------------------------------------------
     32 | WARNING | Open page callback found, please add a comment before the
        |         | line why there is no access restriction
    ---------------------------------------------------------------------------
    
  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.
  • This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

    The settings page can be edited by any anonymous user, which is a security blocker right now. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.

    ayaz.mrz’s picture

    Hi Arun,

    I did PAReview and found following issue

    Review of the 7.x-1.x branch (commit fa137a1):

    googleanalytics_vimeo.js: line 33, col 7, Error - "vimeoGAJS" is not defined. (no-undef)
    googleanalytics_vimeo.js: line 34, col 14, Error - "vimeoGAJS" is not defined. (no-undef)
    
    2 problems
    
    arun ak’s picture

    Status: Needs work » Needs review

    Hi klausi,

    Thanks for your review. I have fixed the issues you mentioned above.

    1) Fixed spacing issue googleanalytics_vimeo.inc fie.
    2) Fixed "vimeoGAJS" is not defined. (no-undef) issue in googleanalytics_vimeo.js.
    3) Admin page access restriction issue fixed. Now admin page is not accessible by anonymous users.

    @ayaz.mrz, js issue you mentioned also fixed.

    Thanks,
    ARUN AK

    klausi’s picture

    Assigned: Unassigned » ayesh
    Status: Needs review » Reviewed & tested by the community

    Review of the 7.x-1.x branch (commit fe32e09):

    /home/klausi/pareview_temp/googleanalytics_vimeo.js: line 8, col 3, Error - Strings must use singlequote. (quotes)
    /home/klausi/pareview_temp/googleanalytics_vimeo.js: line 22, col 28, Error - Strings must use singlequote. (quotes)
    
  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.
  • This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

    manual review:

    1. googleanalytics_vimeo_requirements(): do not concatenate the argument message passed to $t(), otherwise it is hard to get the string for automated translatable string extraction tools.
    2. googleanalytics_vimeo_page_alter(): if you are only adding stuff to the page render array you should use hook_page_build() instead.
    3. googleanalytics_vimeo_js_alter(): why is that hook needed? You are already adding the JS to the footer in googleanalytics_vimeo_page_alter()? Please add a comment.

    Otherwise looks good to me. Assigning to Ayesh as he might have time to take a final look at this.

    arun ak’s picture

    Hi klausi,

    I have fixed the issues mentioned by you.

    1. Fixed quotes issue in googleanalytics_vimeo.js file.
    2. I have replaced hook_page_alter() with hook_page_build().
    3. Previously there was some js issue I faced. So I added googleanalytics_vimeo_js_alter() function to alter the order of js files. But as per your previous comments that issue has been fixed. So I removed googleanalytics_vimeo_js_alter() function. Now it is working fine.
    4. Removed concatenated message passing to $t()

    Thanks,
    ARUN AK

    klausi’s picture

    Assigned: ayesh » Unassigned
    Status: Reviewed & tested by the community » Fixed

    no objections for more than a week, so ...

    Thanks for your contribution, ARUN AK!

    I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

    Here are some recommended readings to help with excellent maintainership:

    You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

    Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

    Thanks to the dedicated reviewer(s) as well.

    Status: Fixed » Closed (fixed)

    Automatically closed - issue fixed for 2 weeks with no activity.