Skip to content

Commit

Permalink
add support for user level analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
akbansa committed Dec 18, 2024
1 parent 390bed4 commit 996df27
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 10 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Gumlet Wordpress Video Plugin


An official plugin by Gumlet for video embedding, dynamic watermark configuration and shortcode.
An official plugin by Gumlet for video embedding, dynamic watermark configuration, user level analytics and shortcode.

Description
-----------
Expand All @@ -13,6 +13,7 @@ Description
> * Use shortcode to embed videos quickly
> * Responsive video embeds or use custom dimensions
> * CDN delivery by AWS CloudFront (215+ locations)
> * Track user level analytics for deeper insights
This is the plugin you ever need to secure videos!

Expand Down
Binary file modified gumlet-video-plugin-assets/Screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified gumlet-video-plugin-assets/Screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions gumlet-video.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Plugin Name: Gumlet Video
* Description: Video Hosting Plugin for WordPress
* Plugin URI: https://github.com/gumlet/wordpress-video-plugin
* Version: 1.0.1
* Version: 1.1
* Author: Gumlet
* Author URI: https://www.gumlet.com
* Text Domain: gumlet-video
Expand Down Expand Up @@ -36,6 +36,7 @@ function gumlet_video_shortcode($atts)
'cc_enabled' => get_option('gumlet_default_cc_enabled'),
'id' => 'id',
'annotate'=> true,
'user_analytics'=> get_option('gumlet_default_user_analytics'),
'autoplay'=> false,
'loop'=> false,
'controls'=> 'on',
Expand All @@ -47,6 +48,7 @@ function gumlet_video_shortcode($atts)
$id = $sc_args['id'];
$annotate = $sc_args['annotate'];
$cc_enabled = $sc_args['cc_enabled'];
$user_analytics = $sc_args['user_analytics'];

if (!$atts['id']) {
return "Required argument id for embedded video not found.";
Expand All @@ -55,7 +57,8 @@ function gumlet_video_shortcode($atts)
}

$watermark_text = '';
if($annotate) {
$logged_in = is_user_logged_in();
if($annotate && $logged_in) {
$current_user = wp_get_current_user();
if(isset($watermark['dynamic_watermark_name']) && $watermark['dynamic_watermark_name']) {
$watermark_text .= $current_user->display_name . " ";
Expand All @@ -67,6 +70,12 @@ function gumlet_video_shortcode($atts)
$watermark_text .= $current_user->ID;
}
}
$analytics_text = '';
if($user_analytics && $logged_in) {
$analytics_text = 'gm_user_id='.$current_user->ID.
'&gm_user_name='. urlencode($current_user->display_name).
'&gm_user_email='.$current_user->user_email;
}

$uniq = 'u' . wp_rand();
$url = "https://play.gumlet.io/embed/$video?";
Expand All @@ -83,7 +92,10 @@ function gumlet_video_shortcode($atts)
$url .= "caption=true&";
}
if($watermark_text != '') {
$url .= "watermark_text=".$watermark_text;
$url .= "watermark_text=".$watermark_text."&";
}
if($analytics_text != '') {
$url .= $analytics_text;
}
if($width != "100%") {
$opening_div = '<div>';
Expand Down Expand Up @@ -132,4 +144,7 @@ function gumlet_video_plugin_activate()
if(!get_option('gumlet_default_cc_enabled')) {
update_option('gumlet_default_cc_enabled', 1);
}
if(!get_option('gumlet_default_user_analytics')) {
update_option('gumlet_default_user_analytics', 1);
}
}
24 changes: 21 additions & 3 deletions includes/video-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function gumlet_options_page()
<tr>
<th>
<label class="description" for="gumlet_default_cc_enabled">
<?php esc_html_e('Show Subtitles automatically', 'gumlet-video'); ?>
<?php esc_html_e('Show subtitles automatically', 'gumlet-video'); ?>
</label>
</th>
<td>
Expand All @@ -73,6 +73,18 @@ public function gumlet_options_page()
<p class="help-text">If this is enabled, the videos having subtitles will show it by default.</p>
</td>
</tr>
<tr>
<th>
<label class="description" for="gumlet_default_user_analytics">
<?php esc_html_e('Track user analytics', 'gumlet-video'); ?>
</label>
</th>
<td>
<input id="gumlet_default_user_analytics" type="checkbox" name="gumlet_default_user_analytics" value="1"
<?php checked(get_option('gumlet_default_user_analytics')) ?> />
<p class="help-text">If this is enabled, the analytics will also have user data when they are logged in.</p>
</td>
</tr>
<tr id="dynamic_watermark_options">
<th>
<label class="description" for="">
Expand Down Expand Up @@ -147,18 +159,24 @@ public function gumlet_register_settings()
}
return ["dynamic_watermark_email" => 0, "dynamic_watermark_name"=> 0, "dynamic_watermark_user_id"=> 0];
});

register_setting('gumlet_video_settings_group', 'gumlet_default_cc_enabled', function($input) {
if(!empty($input)) {
return filter_var( $input, FILTER_VALIDATE_BOOLEAN );
}
return 0;
});
register_setting('gumlet_video_settings_group', 'gumlet_default_user_analytics', function($input) {
if(!empty($input)) {
return filter_var( $input, FILTER_VALIDATE_BOOLEAN );
}
return 0;
});
}


public function load_plugin_script_files(){
wp_register_style('admin_tabs', esc_url(plugins_url('includes/assets/css/tabs.css', __DIR__)), false, '1.0.1');
wp_register_style('admin_tabs', esc_url(plugins_url('includes/assets/css/tabs.css', __DIR__)), false, '1.1');
wp_enqueue_style('admin_tabs');
}

Expand Down
12 changes: 9 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ Text Domain: gumlet-video
Author URI: https://www.gumlet.com
Requires at least: 5.2
Tested up to: 6.6
Stable tag: 1.0.1
Stable tag: 1.1
Requires PHP: 7.2
License: GPLv2
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html

An official plugin by Gumlet for video embedding, dynamic watermark configuration and shortcode.
An official plugin by Gumlet for video embedding, dynamic watermark configuration, user level analytics and shortcode.

== Description ==

> **The plugin offers dynamic watermarking, player customisation and embed shortcode for Gumlet videos**
> **The plugin offers dynamic watermarking, player customisation, user level analytics, and embed shortcode for Gumlet videos**
>
> * Automate your video security using dynamic watermark support
> * Select specific user data such as name, email, id to show as the dynamic watermark
> * Use shortcode to embed videos quickly
> * Responsive video embeds or use custom dimensions
> * CDN delivery by AWS CloudFront (215+ locations)
> * Track user level analytics for deeper insights
> * Gumlet uses play.gumlet.io domain for data transfer. This domain is owned by https://www.gumlet.com. Read [Privacy Policy](https://www.gumlet.com/privacy/) and [Terms of Service](https://www.gumlet.com/terms/)

This is the plugin you will ever need for securing videos!
Expand Down Expand Up @@ -71,6 +72,11 @@ Gumlet Video plugin is free to use. However, to use the dynamic watermark on you

== Changelog ==

= 1.1 =
* Added support for user level analytics
* Fixed bug for non-logged in user for dynamic watermark


= 1.0 =
* First plugin version
* Shortcode to Embed Gumlet video
Expand Down

0 comments on commit 996df27

Please sign in to comment.