I just recently installed this module, set it up with all the correct variables from Google, enabled it on the content type and lastly enabled it on the specific node. Directly after saving the node's settings, I get this error from Drupal:
warning: Attempt to assign property of non-object in /var/www/taxschool/public_html/includes/theme.inc on line 1862.
I'll be looking further into this, but would like to let others know.

Thank you,
-Marcus

Comments

nerdacus’s picture

Found it.

The global language variable was being rewritten, so I just change the name of the temp variable like so:

if (arg(0) != 'admin' && $track > 0) {
  if($node->google_adwords['enabled'] <> 0) {

    $label = $node->google_adwords['label'];
    $id = variable_get('google_adwords_conversion_id', 0);
    // vvvvvvvv          VARIABLE NAME CHANGE          vvvvvvvv
    $google_conversion_language = variable_get('google_adwords_conversion_language', $language->language);
    // ^^^^^^^          VARIABLE NAME CHANGE          ^^^^^^^
    $format = variable_get('google_adwords_conversion_format', '2');
    $color = variable_get('google_adwords_conversion_color', 'FFFFFF');
    $google_js = variable_get('google_adwords_external_script', 'https://www.googleadservices.com/pagead/conversion.js');

    $output = '';

    $output .= "\n" . '<!-- Google Code for Conversion Page -->' . "\n";
    $output .= '<script language="JavaScript" type="text/javascript">' . "\n";
    $output .= '<!--' . "\n";
    $output .= '    var google_conversion_id = '. $id .';' . "\n";
    // vvvvvvvv          VARIABLE NAME CHANGE          vvvvvvvv
    $output .= '    var google_conversion_language = "'. $google_conversion_language .'";' . "\n";
    // ^^^^^^^          VARIABLE NAME CHANGE          ^^^^^^^
    $output .= '    var google_conversion_format = "'. $format .'";' . "\n";

This is much similar to #986612: $type overwritten if passed by reference.

-Marcus

michaelmalak’s picture

Thank you for finding that!

Just to be pedantic, for others like myself who may not yet be PHP programmers, the variable name has to be changed in multiple places:

function _google_adwords_view_adwords($node) {
  global $user;
  global $google_conversion_language;
	
	$track = 0;
	if (is_array($user->roles)) {
		foreach ($user->roles as $role) {
			$role = str_replace(' ', '_', $role);
			$track += variable_get("google_adwords_track_{$role}", FALSE);
		}
	}
	
	// Don't track page views in the admin sections, or for certain roles
	if (arg(0) != 'admin' && $track > 0) {
		if($node->google_adwords['enabled'] <> 0) {
		  
      $label = $node->google_adwords['label'];
		  $id = variable_get('google_adwords_conversion_id', 0);
		  $google_conversion_language = variable_get('google_adwords_conversion_language', $language->language);
		  $format = variable_get('google_adwords_conversion_format', '2');
		  $color = variable_get('google_adwords_conversion_color', 'FFFFFF');
		  $google_js = variable_get('google_adwords_external_script', 'https://www.googleadservices.com/pagead/conversion.js');
		  
		  $output = '';
		  
		  $output .= "\n" . '<!-- Google Code for Conversion Page -->' . "\n";
		  $output .= '<script language="JavaScript" type="text/javascript">' . "\n";
		  $output .= '<!--' . "\n";
		  $output .= '    var google_conversion_id = '. $id .';' . "\n";
		  $output .= '    var google_conversion_language = "'. $google_conversion_language .'";' . "\n";
attiks’s picture

Status: Active » Needs review
StatusFileSize
new1.42 KB

#2 global $google_conversion_language; is wrong, you need the global $language; to be able to access $language->language at line 192

Patch attached

attiks’s picture

StatusFileSize
new1.37 KB

New patch attached, it uses the current language, so people will see the information in their language

jasonsavino’s picture

Assigned: Unassigned » jasonsavino
Status: Needs review » Closed (fixed)