WordPress.org

Forums

Google Analytics by Yoast
Bug -- Author Display Name with Apostrophe Breaks Analytics Submission JavaScrip (2 posts)

  1. JKULESZA
    Member
    Posted 2 years ago #

    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/

  2. JKULESZA
    Member
    Posted 1 year ago #

    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'] ) {

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Google Analytics by Yoast
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.