Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter anaderi

    (@anaderi)

    Yes I have

    Thread Starter anaderi

    (@anaderi)

    Hey, sorry, I forgot about this post, but I have a solution.

    Go here: /wp-content/plugins/google-analytics-for-wordpress/frontend

    and change the code block that starts with the comment “//set tracking code here”. You can see where I changed it for the “else” statement, but you can do it for any of the “ifs” as well.If you need to add the sample rate code where there is already curly bracket code, just add a comma follow by the code snippet. e.g. if there is already {‘allowAnchor’: true} then just add {‘allowAnchor’: true, siteSpeedSampleRate:100}

    ***Note on syntax: Anything you put in between quotes “” will end up getting written into the GA code.

    // Set tracking code here
    			if ( ! empty( $ua_code ) ) {
    				if ( $this->options['add_allow_linker'] && ! $this->options['allow_anchor'] ) {
    					$gaq_push[] = "'create', '" . $ua_code . "', '" . $domain . "', {'allowLinker': true}";
    				} else {
    					if ( $this->options['allow_anchor'] && ! $this->options['add_allow_linker'] ) {
    						$gaq_push[] = "'create', '" . $ua_code . "', '" . $domain . "', {'allowAnchor': true}";
    					} else {
    						if ( $this->options['allow_anchor'] && $this->options['add_allow_linker'] ) {
    							$gaq_push[] = "'create', '" . $ua_code . "', '" . $domain . "', {'allowAnchor': true, 'allowLinker': true}";
    						} else {
    							$gaq_push[] = "'create', '" . $ua_code . "', {siteSpeedSampleRate:100}";
    						}
    					}
    				}
    			}
Viewing 2 replies - 1 through 2 (of 2 total)