Data too long for column 'pagepath'

Created on 5 June 2015, over 9 years ago
Updated 10 July 2023, over 1 year ago

after run cron, in Recent log messages

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'pagepath' at row 1: INSERT INTO {google_analytics_counter} (pagepath_hash, pagepath, pageviews) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => d9007397f55d7b2a535a67a2aa57d1e2 [:db_insert_placeholder_1] => /404.html?page=/content/custompage.html&from=http://yandex.ua/clck/jsredir?from=yandex.ua;search/;web;;&text=&etext=6... [:db_insert_placeholder_2] => 1 ) in google_analytics_counter_update_path_counts() (line 85 of /mypatch/www/sites/all/modules/modified/google_analytics_counter/google_analytics_counter_data.inc).

in google_analytics_counter_data.inc

      foreach ($resultsretrieved as $val) {

        // http://drupal.org/node/310085
        db_merge('google_analytics_counter')
        ->key(array('pagepath_hash' => md5($val['pagePath'])))
        ->fields(array(
          'pagepath' => check_plain($val['pagePath']), // Added check_plain; see https://www.drupal.org/node/2381703
          'pageviews' => check_plain($val['pageviews']), // Added check_plain; see https://www.drupal.org/node/2381703
          ))
        ->execute();

      }

add $val['pagePath'] = drupal_substr($val['pagePath'], 0, 2000);

      foreach ($resultsretrieved as $val) {

        $val['pagePath'] = drupal_substr($val['pagePath'], 0, 2000);

        // http://drupal.org/node/310085
        db_merge('google_analytics_counter')
        ->key(array('pagepath_hash' => md5($val['pagePath'])))
        ->fields(array(
          'pagepath' => check_plain($val['pagePath']), // Added check_plain; see https://www.drupal.org/node/2381703
          'pageviews' => check_plain($val['pageviews']), // Added check_plain; see https://www.drupal.org/node/2381703
          ))
        ->execute();

      }

after this, working

πŸ› Bug report
Status

Closed: outdated

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine proweb.ua

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΈπŸ‡°Slovakia kaszarobert

    Because of the Universal Analytics shutdown, version 7.x-3.x is no longer supported.
    As Drupal 7 EOL is close, please consider upgrading to the latest Drupal and latest version of this module with Google Analytics 4 support.
    If you are still here and experiencing problems with the latest version using GA4, then please open an issue about it.

Production build 0.71.5 2024