Skip to content
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

Add missing semicolon. #32

Open
wants to merge 4 commits into
base: 1.x-2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
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
12 changes: 9 additions & 3 deletions googleanalytics.module
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,9 @@ function googleanalytics_preprocess_layout() {
// @FIXME: Cannot find the debug URL!???
$library = 'https://www.googletagmanager.com/gtag/js?id=' . $id_list[0];
}
elseif ($config->get('googleanalytics_cache') && $url = _googleanalytics_cache('https://www.googletagmanager.com/gtag/js')) {
elseif ($config->get('cache') && $url = _googleanalytics_cache('https://www.googletagmanager.com/gtag/js')) {
// Should a local cached copy of gtag.js be used?
$query_string = '?' . state_get('css_js_query_string', '0');
$query_string = '?' . state_get('css_js_query_string', base_convert(REQUEST_TIME, 10, 36));
$library = $url . $query_string;
}
else {
Expand Down Expand Up @@ -443,8 +443,9 @@ function googleanalytics_field_extra_fields() {
function googleanalytics_form_user_profile_form_alter(&$form, &$form_state) {
$account = $form['#user'];
$config = config('googleanalytics.settings');
$custom = $config->get('custom');

if (user_access('opt-in or out of tracking') && ($custom = $config->get('custom')) != 0 && _googleanalytics_visibility_roles($account)) {
if (user_access('opt-in or out of tracking') && $custom != 0 && _googleanalytics_visibility_roles($account)) {
$form['googleanalytics'] = array(
'#type' => 'fieldset',
'#title' => t('Google Analytics configuration'),
Expand All @@ -468,6 +469,11 @@ function googleanalytics_form_user_profile_form_alter(&$form, &$form_state) {
if ($config->get('privacy_donottrack') && !empty($_SERVER['HTTP_DNT'])) {
$disabled = TRUE;

// Ensure account data is an array.
if (!is_array($account->data)) {
$account->data = array();
}

// Override settings value.
$account->data['googleanalytics'] = array('custom' => FALSE);

Expand Down
6 changes: 3 additions & 3 deletions js/googleanalytics.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $(document).ready(function() {
else if (Backdrop.googleanalytics.isInternalSpecial(this.href)) {
// Keep the internal URL for Google Analytics website overlay intact.
console.info("Click on internal special link '%s' has been tracked.", Backdrop.googleanalytics.getPageUrl(this.href));
gtag('config', backdropSettings.google_analytics.account, {
gtag('config', Backdrop.settings.google_analytics.account, {
page_path: Backdrop.googleanalytics.getPageUrl(this.href),
transport_type: 'beacon'
});
Expand Down Expand Up @@ -80,7 +80,7 @@ $(document).ready(function() {
if (Backdrop.settings.googleanalytics.trackUrlFragments) {
window.onhashchange = function() {
console.info("Track URL '%s' as pageview. Hash '%s' has changed.", location.pathname + location.search + location.hash, location.hash);
gtag('config', backdropSettings.google_analytics.account, {
gtag('config', Backdrop.settings.google_analytics.account, {
page_path: location.pathname + location.search + location.hash
});
};
Expand All @@ -93,7 +93,7 @@ $(document).ready(function() {
var href = $.colorbox.element().attr("href");
if (href) {
console.info("Colorbox transition to url '%s' has been tracked.", Backdrop.googleanalytics.getPageUrl(href));
gtag('config', backdropSettings.google_analytics.account, {
gtag('config', Backdrop.settings.google_analytics.account, {
page_path: Backdrop.googleanalytics.getPageUrl(href)
});
}
Expand Down
6 changes: 3 additions & 3 deletions js/googleanalytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $(document).ready(function() {
// Keep the internal URL for Google Analytics website overlay intact.
// @todo: May require tracking ID
var target = this;
$.each(backdropSettings.google_analytics.account, function () {
$.each(Backdrop.settings.google_analytics.account, function () {
gtag('config', this, {
page_path: Backdrop.googleanalytics.getPageUrl(target.href),
transport_type: 'beacon'
Expand Down Expand Up @@ -67,7 +67,7 @@ $(document).ready(function() {
// Track hash changes as unique pageviews, if this option has been enabled.
if (Backdrop.settings.googleanalytics.trackUrlFragments) {
window.onhashchange = function() {
$.each(backdropSettings.google_analytics.account, function () {
$.each(Backdrop.settings.google_analytics.account, function () {
gtag('config', this, {
page_path: location.pathname + location.search + location.hash
});
Expand All @@ -81,7 +81,7 @@ $(document).ready(function() {
$(document).bind("cbox_complete", function () {
var href = $.colorbox.element().attr("href");
if (href) {
$.each(backdropSettings.google_analytics.account, function () {
$.each(Backdrop.settings.google_analytics.account, function () {
gtag('config', this, {
page_path: Backdrop.googleanalytics.getPageUrl(href)
});
Expand Down