first commit

This commit is contained in:
2024-11-10 21:08:49 +01:00
commit 0d932ce5ee
14455 changed files with 2567501 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<?php
use PixelYourSite\GA\Helpers;
function getCompleteRegistrationEventParamsV4() {
if ( ! PixelYourSite\GA()->getOption( 'complete_registration_event_enabled' ) ) {
return false;
}
return array(
'name' => 'sign_up',
'data' => array(
'content_name' => get_the_title(),
'event_url' => \PixelYourSite\getCurrentPageUrl(true),
'method' => \PixelYourSite\getUserRoles(),
'non_interaction' => PixelYourSite\GA()->getOption( 'complete_registration_event_non_interactive' ),
),
);
}

View File

@@ -0,0 +1,82 @@
<?php
namespace PixelYourSite\GA\Helpers;
use PixelYourSite;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Render Cross Domain Domain text field
*
* @param int $index
*/
function renderCrossDomainDomain( $index = 0 ) {
$slug = PixelYourSite\GA()->getSlug();
$attr_name = "pys[$slug][cross_domain_domains][]";
$attr_id = 'pys_' . $slug . '_cross_domain_domains_' . $index;
$values = (array) PixelYourSite\GA()->getOption( 'cross_domain_domains' );
$attr_value = isset( $values[ $index ] ) ? $values[ $index ] : null;
?>
<input type="text" name="<?php esc_attr_e( $attr_name ); ?>"
id="<?php esc_attr_e( $attr_id ); ?>"
value="<?php esc_attr_e( $attr_value ); ?>"
placeholder="Enter domain"
class="form-control">
<?php
}
function getWooProductContentId( $product_id ) {
if ( PixelYourSite\GA()->getOption( 'woo_content_id' ) == 'product_sku' ) {
$content_id = get_post_meta( $product_id, '_sku', true );
} else {
$content_id = $product_id;
}
$prefix = PixelYourSite\GA()->getOption( 'woo_content_id_prefix' );
$suffix = PixelYourSite\GA()->getOption( 'woo_content_id_suffix' );
$value = $prefix . $content_id . $suffix;
return $value;
}
function getWooCartItemId( $item ) {
if ( ! PixelYourSite\GA()->getOption( 'woo_variable_as_simple' ) && isset( $item['variation_id'] ) && $item['variation_id'] !== 0 ) {
$product_id = $item['variation_id'];
} else {
$product_id = $item['product_id'];
}
return $product_id;
}
/*
* EASY DIGITAL DOWNLOADS
*/
function getEddDownloadContentId( $download_id )
{
if (PixelYourSite\GA()->getOption('edd_content_id') == 'download_sku') {
$content_id = get_post_meta($download_id, 'edd_sku', true);
} else {
$content_id = $download_id;
}
$prefix = PixelYourSite\GA()->getOption('edd_content_id_prefix');
$suffix = PixelYourSite\GA()->getOption('edd_content_id_suffix');
return $prefix . $content_id . $suffix;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,75 @@
{
"enabled": true,
"is_enable_debug_mode": "",
"tracking_id": "",
"enhance_link_attribution": false,
"anonimize_ip": false,
"cross_domain_enabled": false,
"cross_domain_accept_incoming": false,
"cross_domain_domains": [],
"search_event_non_interactive": true,
"comment_event_enabled": true,
"comment_event_non_interactive": false,
"download_event_enabled": true,
"download_event_non_interactive": false,
"form_event_enabled": true,
"form_event_non_interactive": false,
"woo_variable_as_simple": false,
"woo_content_id": "product_id",
"woo_content_id_prefix": "",
"woo_content_id_suffix": "",
"woo_purchase_enabled": true,
"woo_purchase_non_interactive": true,
"woo_initiate_checkout_enabled": true,
"woo_initiate_checkout_non_interactive": true,
"woo_remove_from_cart_enabled": true,
"woo_remove_from_cart_non_interactive": false,
"woo_add_to_cart_enabled": true,
"woo_add_to_cart_non_interactive": false,
"woo_view_content_enabled": true,
"woo_view_content_non_interactive": true,
"woo_view_category_enabled": true,
"woo_view_category_non_interactive": true,
"edd_content_id": "download_id",
"edd_content_id_prefix": "",
"edd_content_id_suffix": "",
"edd_purchase_enabled": true,
"edd_purchase_non_interactive": true,
"edd_initiate_checkout_enabled": true,
"edd_initiate_checkout_non_interactive": true,
"edd_remove_from_cart_enabled": true,
"edd_remove_from_cart_non_interactive": false,
"edd_add_to_cart_enabled": true,
"edd_add_to_cart_non_interactive": false,
"edd_view_content_enabled": true,
"edd_view_content_non_interactive": true,
"edd_view_category_enabled": true,
"edd_view_category_non_interactive": true,
"disable_advertising_features": false,
"disable_advertising_personalization": false,
"automatic_event_form_enabled": true,
"automatic_event_signup_enabled": true,
"automatic_event_login_enabled": true,
"automatic_event_download_enabled": true,
"automatic_event_comment_enabled": true,
"automatic_event_scroll_enabled": true,
"automatic_event_time_on_page_enabled": true,
"automatic_event_search_enabled": true,
"automatic_event_form_non_interactive_enabled": false,
"automatic_event_signup_non_interactive_enabled": false,
"automatic_event_login_non_interactive_enabled": false,
"automatic_event_download_non_interactive_enabled": false,
"automatic_event_comment_non_interactive_enabled": false,
"automatic_event_scroll_non_interactive_enabled": false,
"automatic_event_time_on_page_non_interactive_enabled": false,
"automatic_event_search_non_interactive_enabled": false
}

View File

@@ -0,0 +1,75 @@
{
"enabled": "checkbox",
"is_enable_debug_mode": "array",
"tracking_id": "array",
"enhance_link_attribution": "checkbox",
"anonimize_ip": "checkbox",
"cross_domain_enabled": "checkbox",
"cross_domain_accept_incoming": "checkbox",
"cross_domain_domains": "array",
"search_event_non_interactive": "checkbox",
"comment_event_enabled": "checkbox",
"comment_event_non_interactive": "checkbox",
"download_event_enabled": "checkbox",
"download_event_non_interactive": "checkbox",
"form_event_enabled": "checkbox",
"form_event_non_interactive": "checkbox",
"woo_variable_as_simple": "checkbox",
"woo_content_id": "select",
"woo_content_id_prefix": "text",
"woo_content_id_suffix": "text",
"woo_purchase_enabled": "checkbox",
"woo_purchase_non_interactive": "checkbox",
"woo_initiate_checkout_enabled": "checkbox",
"woo_initiate_checkout_non_interactive": "checkbox",
"woo_remove_from_cart_enabled": "checkbox",
"woo_remove_from_cart_non_interactive": "checkbox",
"woo_add_to_cart_enabled": "checkbox",
"woo_add_to_cart_non_interactive": "checkbox",
"woo_view_content_enabled": "checkbox",
"woo_view_content_non_interactive": "checkbox",
"woo_view_category_enabled": "checkbox",
"woo_view_category_non_interactive": "checkbox",
"edd_content_id": "select",
"edd_content_id_prefix": "text",
"edd_content_id_suffix": "text",
"edd_purchase_enabled": "checkbox",
"edd_purchase_non_interactive": "checkbox",
"edd_initiate_checkout_enabled": "checkbox",
"edd_initiate_checkout_non_interactive": "checkbox",
"edd_remove_from_cart_enabled": "checkbox",
"edd_remove_from_cart_non_interactive": "checkbox",
"edd_add_to_cart_enabled": "checkbox",
"edd_add_to_cart_non_interactive": "checkbox",
"edd_view_content_enabled": "checkbox",
"edd_view_content_non_interactive": "checkbox",
"edd_view_category_enabled": "checkbox",
"edd_view_category_non_interactive": "checkbox",
"disable_advertising_features": "checkbox",
"disable_advertising_personalization": "checkbox",
"automatic_event_form_enabled": "checkbox",
"automatic_event_signup_enabled": "checkbox",
"automatic_event_login_enabled": "checkbox",
"automatic_event_download_enabled": "checkbox",
"automatic_event_comment_enabled": "checkbox",
"automatic_event_scroll_enabled": "checkbox",
"automatic_event_time_on_page_enabled": "checkbox",
"automatic_event_search_enabled": "checkbox",
"automatic_event_form_non_interactive_enabled": "checkbox",
"automatic_event_signup_non_interactive_enabled": "checkbox",
"automatic_event_login_non_interactive_enabled": "checkbox",
"automatic_event_download_non_interactive_enabled": "checkbox",
"automatic_event_comment_non_interactive_enabled": "checkbox",
"automatic_event_scroll_non_interactive_enabled": "checkbox",
"automatic_event_time_on_page_non_interactive_enabled": "checkbox",
"automatic_event_search_non_interactive_enabled": "checkbox"
}

View File

@@ -0,0 +1,208 @@
<?php
namespace PixelYourSite;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
use PixelYourSite\GA\Helpers;
?>
<h2 class="section-title">Google Analytics Settings</h2>
<!-- General -->
<div class="card card-static">
<div class="card-header">
General
</div>
<div class="card-body">
<div class="row mb-3">
<div class="col">
<?php GA()->render_switcher_input( 'enabled' ); ?>
<h4 class="switcher-label">Enable Google Analytics</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php GA()->render_switcher_input( 'enhance_link_attribution' ); ?>
<h4 class="switcher-label">Enable Enhance Link Attribution</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php GA()->render_switcher_input( 'disable_advertising_features' ); ?>
<h4 class="switcher-label">Disable all advertising features</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php GA()->render_switcher_input( 'disable_advertising_personalization' ); ?>
<h4 class="switcher-label">Disable advertising personalization</h4>
</div>
</div>
<div class="row">
<div class="col">
<?php GA()->render_switcher_input( 'anonimize_ip' ); ?>
<h4 class="switcher-label">Anonimize IP</h4>
</div>
</div>
<div class="row">
<div class="col-11 col-offset-left">
<div class="indicator indicator-off">OFF</div>
<h4 class="indicator-label">Tracking Custom Dimensions</h4>
</div>
<div class="col-1">
<?php renderExternalHelpIcon( 'https://www.pixelyoursite.com/documentation/google-analytics-custom-dimensions?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-analytics-settings' ); ?>
</div>
</div>
</div>
</div>
<!-- Google Optimize -->
<div class="card card-static">
<div class="card-header">
Google Optimize <?php renderProBadge( 'https://www.pixelyoursite.com/google-analytics?utm_source=pys-free-plugin&utm_medium=pro-badge&utm_campaign=pro-feature' ); ?>
</div>
<div class="card-body">
<div class="row mb-3">
<div class="col">
<?php renderDummySwitcher(); ?>
<h4 class="switcher-label">Enable Google Optimize</h4>
</div>
</div>
<div class="row mb-3">
<div class="col">
<?php renderDummyTextInput('Enter Optimize ID'); ?>
</div>
</div>
<div class="row ">
<div class="col">
<p>
Learn how to configure Google Optimize:
<a href="https://www.youtube.com/watch?v=a5jPcLbdgy0" target="_blank">watch
video</a>
</p>
</div>
</div>
</div>
</div>
<!-- Cross-Domain Tracking -->
<!-- @link: https://developers.google.com/analytics/devguides/collection/gtagjs/cross-domain -->
<div class="card card-static">
<div class="card-header">
Cross-Domain Tracking
</div>
<div class="card-body">
<div class="row mb-3">
<div class="col-11">
<?php GA()->render_switcher_input( 'cross_domain_enabled' ); ?>
<h4 class="switcher-label">Enable Cross-Domain Tracking</h4>
</div>
<div class="col-1">
<?php renderPopoverButton( 'ga_cross_domain_tracking' ); ?>
</div>
</div>
<div class="row mb-3">
<div class="col col-offset-left">
<?php GA()->render_switcher_input( 'cross_domain_accept_incoming' ); ?>
<h4 class="switcher-label">Accept incoming</h4>
</div>
</div>
<div class="row mt-3">
<div class="col-5 col-offset-left">
<?php Helpers\renderCrossDomainDomain( 0 ); ?>
</div>
</div>
<?php foreach ( GA()->getOption('cross_domain_domains') as $index => $domain ) : ?>
<?php
if ( $index === 0 ) {
continue; // skip default ID
}
?>
<div class="row mt-3">
<div class="col-5 col-offset-left">
<?php Helpers\renderCrossDomainDomain( $index ); ?>
</div>
<div class="col-2">
<button type="button" class="btn btn-sm remove-row">
<i class="fa fa-trash-o" aria-hidden="true"></i>
</button>
</div>
</div>
<?php endforeach; ?>
<div class="row mt-3" id="pys_ga_cross_domain_domain" style="display: none;">
<div class="col-5 col-offset-left">
<input type="text" name="" id="" value="" placeholder="Enter domain" class="form-control">
</div>
<div class="col-2">
<button type="button" class="btn btn-sm remove-row">
<i class="fa fa-trash-o" aria-hidden="true"></i>
</button>
</div>
</div>
<div class="row mt-3">
<div class="col-5 col-offset-left">
<button class="btn btn-sm btn-block btn-primary" type="button"
id="pys_ga_add_cross_domain_domain">
Add Extra Domain
</button>
</div>
</div>
</div>
</div>
<div class="panel">
<div class="row">
<div class="col text-center">
<p class="mb-0">Track more actions with the PRO version.
<br><a href="https://www.pixelyoursite.com/google-analytics?utm_source=pixelyoursite-free-plugin&utm_medium=plugin&utm_campaign=free-plugin-analytics-settings"
target="_blank">Find more about the Google Analytics pro implementation</a></p>
</div>
</div>
</div>
<hr>
<div class="row justify-content-center">
<div class="col-4">
<button class="btn btn-block btn-save">Save Settings</button>
</div>
</div>
<script type="application/javascript">
jQuery(document).ready(function ($) {
$('#pys_ga_add_cross_domain_domain').click(function (e) {
e.preventDefault();
var $row = $('#pys_ga_cross_domain_domain').clone()
.insertBefore('#pys_ga_cross_domain_domain')
.attr('id', '')
.css('display', 'flex');
$('input[type="text"]', $row)
.attr('name', 'pys[ga][cross_domain_domains][]');
});
$(document).on('click', '.remove-row', function () {
$(this).closest('.row').remove();
});
});
</script>