Skip to content

Commit

Permalink
chore: prepare for 2.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonTheAdams committed Aug 18, 2022
1 parent 277259f commit 28e4920
Show file tree
Hide file tree
Showing 17 changed files with 114 additions and 114 deletions.
81 changes: 39 additions & 42 deletions assets/src/js/give-ga-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,65 @@

jQuery.noConflict();
(function ($) {

/**
* Toggle Conditional Form Fields
*
* @since: 1.0
*/
const toggle_ga_fields = function () {

var ga_tracking_customize = $('input[name="google_analytics_tracking_vals"]');

ga_tracking_customize.on('change', function () {

var ga_tracking_customize_val = $(this).filter(':checked').val();

if ('undefined' === typeof ga_tracking_customize_val) {
return;
}

if (ga_tracking_customize_val === 'default') {
$('.give-ga-advanced-field').hide();
} else {
$('.give-ga-advanced-field').show();
}

}).change();

var ga_tracking_customize = $(
'input[name="google_analytics_tracking_vals"]'
);

ga_tracking_customize
.on("change", function () {
var ga_tracking_customize_val = $(this)
.filter(":checked")
.val();

if ("undefined" === typeof ga_tracking_customize_val) {
return;
}

if (ga_tracking_customize_val === "default") {
$(".give-ga-advanced-field").hide();
} else {
$(".give-ga-advanced-field").show();
}
})
.change();
};

/**
* Toggle Conditional Google Analytics 4 Form Fields
*
* @unreleased
* @since 2.0.0
*/
const toggle_google_analytics_4_fields = function () {

const ga_tracking_mode = $('input[name="google_tracking_mode"]');

ga_tracking_mode.on('change', function () {

const ga_tracking_mode_val = $(this).filter(':checked').val();

if ('undefined' === typeof ga_tracking_mode_val) {
return;
}

if (ga_tracking_mode_val === 'universal-analytics') {
$('.give-universal-analytics').removeClass('give-hidden');
$('.give-google-analytics-4').addClass('give-hidden');
} else {
$('.give-universal-analytics').addClass('give-hidden');
$('.give-google-analytics-4').removeClass('give-hidden');
}

}).change();

ga_tracking_mode
.on("change", function () {
const ga_tracking_mode_val = $(this).filter(":checked").val();

if ("undefined" === typeof ga_tracking_mode_val) {
return;
}

if (ga_tracking_mode_val === "universal-analytics") {
$(".give-universal-analytics").removeClass("give-hidden");
$(".give-google-analytics-4").addClass("give-hidden");
} else {
$(".give-universal-analytics").addClass("give-hidden");
$(".give-google-analytics-4").removeClass("give-hidden");
}
})
.change();
};

// On DOM Ready
$(function () {

toggle_ga_fields();
toggle_google_analytics_4_fields();
});

})(jQuery);
6 changes: 3 additions & 3 deletions give-google-analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Give - Google Analytics Donation Tracking
* Plugin URI: https://givewp.com/addons/google-analytics/
* Description: Add Google Analytics Enhanced eCommerce tracking functionality to Give to track donations.
* Version: 1.2.5
* Version: 2.0.0
* Author: GiveWP
* Author URI: https://givewp.com
* Requires at least: 5.0
Expand All @@ -19,7 +19,7 @@

// Plugin version.
if ( ! defined( 'GIVE_GOOGLE_ANALYTICS_VERSION' ) ) {
define( 'GIVE_GOOGLE_ANALYTICS_VERSION', '1.2.5' );
define( 'GIVE_GOOGLE_ANALYTICS_VERSION', '2.0.0' );
}

// Min. Give version.
Expand Down Expand Up @@ -338,7 +338,7 @@ function Give_Google_Analytics() {
* Load the Service Providers with Give core. This *must* remain outside of the Give_Google_Analytics class
* as it is a completely different bootstrapping system and cannot run inside of the plugins_loaded hook.
*
* @unreleased
* @since 2.0.0
*/
add_action('before_give_init', function () {
// Check Give min required version.
Expand Down
4 changes: 2 additions & 2 deletions includes/class-give-google-analytics-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function setup()
/**
* Add scripts.
*
* @unreleased Load assets from dist directory
* @since 2.0.0 Load assets from dist directory
*/
public function add_scripts($hook)
{
Expand Down Expand Up @@ -311,7 +311,7 @@ public function add_settings($settings)
/**
* Description Field.
*
* @unreleased Load images from dist directory.
* @since 2.0.0 Load images from dist directory.
*/
function description_field()
{
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Contributors: givewp
Tags: donation analytics, donation, ecommerce, e-commerce, fundraising, fundraiser
Requires at least: 5.0
Tested up to: 5.4
Stable tag: 1.2.5
Tested up to: 6.0
Stable tag: 2.0.0
Requires PHP: 7.0
Requires Give: 2.21.3
License: GPLv3
Expand Down Expand Up @@ -40,6 +40,9 @@ Automatic updates should work like a charm; as always though, ensure you backup

== Changelog ==

= 2.0.0: August 18th, 2022 =
* New: Support for Google Analytics 4! Switch within the plugins settings when ready.

= 1.2.5: June 15th, 2020 =
* New: Added support for the upcoming release of GiveWP 2.7.0 and the new donation form template.

Expand Down
20 changes: 10 additions & 10 deletions src/Donations/Actions/RecordDonationInGoogleAnalyticsWithGA4.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use GiveGoogleAnalytics\Settings\Repositories\SettingRepository;

/**
* @unreleased
* @since 2.0.0
*/
class RecordDonationInGoogleAnalyticsWithGA4
{
Expand All @@ -30,7 +30,7 @@ class RecordDonationInGoogleAnalyticsWithGA4
private $settingRepository;

/**
* @unreleased
* @since 2.0.0
*/
public function __construct(
SettingRepository $settingRepository,
Expand All @@ -43,7 +43,7 @@ public function __construct(
}

/**
* @unreleased
* @since 2.0.0
* @return void
*/
public function __invoke($donationId, $newDonationStatus)
Expand All @@ -64,7 +64,7 @@ public function __invoke($donationId, $newDonationStatus)
/**
* This function triggers Google Analytic event for renewal payment.
*
* @unreleased
* @since 2.0.0
*/
public function handleRenewal(Give_Payment $givePayment)
{
Expand All @@ -84,7 +84,7 @@ public function handleRenewal(Give_Payment $givePayment)
/**
* This function sends event data to Google analytics.
*
* @unreleased
* @since 2.0.0
*
* @return void
*/
Expand Down Expand Up @@ -113,7 +113,7 @@ private function sendEvent(Donation $donation)
}

/**
* @unreleased
* @since 2.0.0
*/
private function getEventData(Donation $donation): array
{
Expand Down Expand Up @@ -150,7 +150,7 @@ private function getEventData(Donation $donation): array
/**
* Use this filter hooke to add additional data to Google Analytics purchase event.
*
* @unreleased
* @since 2.0.0
*/
return apply_filters('give_google_analytics_ga4_purchase_event_data', $eventData, $donation);
}
Expand All @@ -159,7 +159,7 @@ private function getEventData(Donation $donation): array
* This function returns donation type label.
* This label used as product category which help to differentiate revenue in Google Analytics Dashboard.
*
* @unreleased
* @since 2.0.0
*/
private function getDonationTypeLabel(Donation $donation): string
{
Expand All @@ -177,7 +177,7 @@ private function getDonationTypeLabel(Donation $donation): string
/**
* This function return Google Analytics client session key.
*
* @unreleased
* @since 2.0.0
*/
private function getGoogleAnalyticsClientSession(Donation $donation): string
{
Expand All @@ -195,7 +195,7 @@ private function getGoogleAnalyticsClientSession(Donation $donation): string
/**
* This function returns the Google Analytics client id which generates on frontend when donor process/view donation form or which website.
*
* @unreleased
* @since 2.0.0
*/
private function getGoogleAnalyticsClientTrackingId(Donation $donation): string
{
Expand Down
12 changes: 6 additions & 6 deletions src/Donations/Actions/RefundDonationInGoogleAnalyticsWithGA4.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class RefundDonationInGoogleAnalyticsWithGA4
private $settingRepository;

/**
* @unreleased
* @since 2.0.0
*/
public function __construct(
SettingRepository $settingRepository,
Expand All @@ -39,7 +39,7 @@ public function __construct(
}

/**
* @unreleased
* @since 2.0.0
*
* @param int $donationId
* @param string $newDonationStatus
Expand Down Expand Up @@ -96,7 +96,7 @@ public function __invoke($donationId, $newDonationStatus, $oldDonationStatus)
}

/**
* @unreleased
* @since 2.0.0
*/
private function getEventData(
Donation $donation,
Expand All @@ -122,15 +122,15 @@ private function getEventData(
/**
* Use this filter hooke to add additional data to Google Analytics refund event.
*
* @unreleased
* @since 2.0.0
*/
return apply_filters('give_google_analytics_ga4_refund_event_data', $eventData, $donation);
}

/**
* This function returns the Google Analytics client id which generates on frontend when donor process/view donation form or which website.
*
* @unreleased
* @since 2.0.0
*/
private function getGoogleAnalyticsClientTrackingId(Donation $donation, bool $isRenewal): string
{
Expand All @@ -144,7 +144,7 @@ private function getGoogleAnalyticsClientTrackingId(Donation $donation, bool $is
/**
* This function return Google Analytics client session key.
*
* @unreleased
* @since 2.0.0
*/
private function getGoogleAnalyticsClientSession(Donation $donation, bool $isRenewal): string
{
Expand Down
10 changes: 5 additions & 5 deletions src/Donations/Actions/StoreDonorGoogleAnalyticsData.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* This class uses to store donor google analytic data when donor process donation.
*
* @unreleased
* @since 2.0.0
*/
class StoreDonorGoogleAnalyticsData
{
Expand All @@ -19,15 +19,15 @@ class StoreDonorGoogleAnalyticsData
private $settingRepository;

/**
* @unreleased
* @since 2.0.0
*/
public function __construct(SettingRepository $settingRepository)
{
$this->settingRepository = $settingRepository;
}

/**
* @unreleased
* @since 2.0.0
*
* @return void
*/
Expand Down Expand Up @@ -63,7 +63,7 @@ public function __invoke(int $donationId)
/**
* This function returns flag whether preserve donor Google Analytics data or not.
*
* @unreleased
* @since 2.0.0
*/
private function canStoreDonorGoogleAnalyticsData(Donation $donation): bool
{
Expand All @@ -75,7 +75,7 @@ private function canStoreDonorGoogleAnalyticsData(Donation $donation): bool
/**
* This function returns session value of client. Session id generates by google Analytics.
*
* @unreleased
* @since 2.0.0
*
* @return string
*/
Expand Down
Loading

0 comments on commit 28e4920

Please sign in to comment.