Skip to content

Analytics version #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Library/Usage.php
Original file line number Diff line number Diff line change
@@ -104,10 +104,30 @@ public function admin_enqueue_scripts() {
date( 'Ymd' )
);

$plugins_data = [];
foreach ( \Boldgrid\Library\Library\Util\Plugin::getFiltered( 'boldgrid' ) as $plugin ) {
$plugins_data[] = [
'plugin' => $plugin['TextDomain'],
'name' => $plugin['Name'],
'version' => $plugin['Version'],
];
}
error_log(serialize(\Boldgrid\Library\Library\Util\Plugin::getFiltered()));
$plugin = '';
$version = '';
foreach ($plugins_data as $plugin_data) {
if (false !== strpos( $_GET['page'], $plugin_data['plugin'] ) ) {
$plugin = $plugin_data['name'];
$version = $plugin_data['version'];
}
}

$translation = [
'page' => ! empty ( $_GET['page'] ) ? $_GET['page'] : '',
'ga_id' => $this->gaId,
'license' => json_encode( $licenseData ),
'plugin' => $plugin,
'version' => $version,
];

wp_localize_script( $handle, 'BglibUsage', $translation );
8 changes: 7 additions & 1 deletion src/assets/js/usage.js
Original file line number Diff line number Diff line change
@@ -87,8 +87,14 @@ BOLDGRID.LIBRARY = BOLDGRID.LIBRARY || {};

// Configure license.
params.license = self.i18n.license;
if ( 'Total Upkeep' === self.i18n.plugin ) {
params.version = self.i18n.version;
} else {
params.version = '';
}
params.custom_map = {
dimension7: 'license'
dimension7: 'license',
dimension8: 'version'
};

// Configure linker. This will add client id, on click, to all boldgrid.com links.