Running 4.7 RC1. Installed and entered google analytics user id -> UA-258XXX-2. However, view source only shows:

and Google cant verify that tracking is installed. Is it suppossed to show:

"

_uacct = "UA-258XXX-2"; urchinTracker();

"

Anyway, I appreciate the help in advance.

Best,

Ivan

CommentFileSizeAuthor
#2 googleanalytics.rar917 bytesmudanoman

Comments

mudanoman’s picture

Status: Active » Closed (fixed)

This seemed to fix it:

/**
* Implementation of hook_footer()
*/
function googleanalytics_footer($main = 0) {
$id = variable_get('googleanalytics_account', '');

if($id != '') {
drupal_set_html_head ('

_uacct = "'.$id.'"; urchinTracker();

');
}
}

mudanoman’s picture

StatusFileSize
new917 bytes

The previous post needs to be deleted.

Attached is the module file that is now working for me in 4.7 RC1. Essentially, the necessary analytics script is added to the header via "drupal_set_html_head".

Peace,

Ivan

budda’s picture

Assigned: Unassigned » budda
Status: Closed (fixed) » Active

Please submit changes as a patch file.

The change is not suitable though. The recent change/suggestion by Google is to place the <script type="text/javascript">_uacct = "'.$id.'"; urchinTracker();</script> in the footer of a page. Your code is actuallt placing this in the header again!

The recent change to the Drupal JS function means I cannot add JavaScript from a remote server, so I will make the required changes.

budda’s picture

Status: Active » Fixed

Fixed including of external JavaScript.
Committed to CVS HEAD, and DRUPAL-4-7 branch.

Anonymous’s picture

Status: Fixed » Closed (fixed)