Support » Plugin: Google Analytics for WordPress by MonsterInsights » Bug — Author Display Name with Apostrophe Breaks Analytics Submission JavaScrip

  • Hello,

    If the display name for an author contains an apostrophe (single quote), and the plugin has been configured to include the custom variable “Author name”, the JavaScript to submit analytics breaks owing to an unescaped single quote within a string delimited by single quotes.

    Example problem name:
    George O’Leary

    Version of plugin: 4.2.8

    Problem in file: google-analytics-for-wordpress/googleanalytics.php

    Problem at line: 1009

    Let me know if you need more information to confirm the issue.

    Thanks!
    – Justin

    http://wordpress.org/extend/plugins/google-analytics-for-wordpress/

Viewing 1 replies (of 1 total)
  • This is still an issue in version in version 4.3.3, just in a different file now. (class-frontend.php at line 177). Any chance of getting it fixed?

    Here’s the patch I’m using:

    --- class-frontend.php	2013-05-24 09:55:15.000000000 -0400
    +++ class-frontend.php	2013-05-24 09:55:39.000000000 -0400
    @@ -177,7 +177,7 @@
                 }
               }
               if ( $this->options['cv_authorname'] ) {
    -            $push[] = "'_setCustomVar',$customvarslot,'author','" . $this->str_clean( get_the_author_meta( 'display_name', $wp_query->post->post_author ) ) . "',3";
    +            $push[] = "'_setCustomVar',$customvarslot,'author',\"" . $this->str_clean( get_the_author_meta( 'display_name', $wp_query->post->post_author ) ) . "\",3";
                 $customvarslot++;
               }
               if ( $this->options['cv_tags'] ) {

Viewing 1 replies (of 1 total)
  • The topic ‘Bug — Author Display Name with Apostrophe Breaks Analytics Submission JavaScrip’ is closed to new replies.