In both 1.4 and 1.x.dev, two single-line textfield profile fields I created Full Name,profile_fullname and District,profile_district do not show in the javascript.
They are listed and highlighted in the GA module page. The built in profile fields like userid and role do show.
I guess this is a bug.
The js is like, pageTracker._setVar("####:test:authenticated user,roles,another role,another role::");
So its expected, but not getting filled in.
Comments
Comment #1
sgriffin commentedI also changed/checked the profile field to public, with no affect.
Comment #2
hass commentedHave you read:
Comment #3
sgriffin commentedyes. how is that relevant?
The roles are being tracked, but the code is not is not loading the specified profile variables into the page tracker line.
They show up blank.
Comment #4
sgriffin commentedI believe the bug is in // Add User profile segmentation values;
Trying out the code by itself also returns blank values
Line 60-74
Comment #5
hass commentedI tried this myself.
0. activated - core "profile" module
First test:
1. Added two fields
2. Added some example data for my testuser
3. Marked the new profile fields in GA configuration to be tracked
4. checked the code added to the page:
pageTracker._setVar("My display name:http://example.com");5. looks as expected
Second test:
6. cleared the url field in user/1
7. checked code
pageTracker._setVar("My display name:");8. looks as expected
Please check the selected profile fields that should be tracked on your site and check if there are values in the user fields. If the field values are blank you get the results you see in 7. Everything works as expected - and please let me say - i haven't changed much on this lines... the implode haven't changed in v1.4 - only change is the drupal_to_js around to make sure nobody can inject arbitrary code that may break the tracking. See #153243 and #178765 what have happened in past.
Comment #6
sgriffin commentedI'm not sure how this become closed.
The profile fields are selected, and there is data in the user fields.
The core is 5.1 so perhaps the method of accessing the profile data has changed.
http://soundzabound.com/user/test
Checking the user page you can see two new profile fields, fullname and district. But the tracking code is still blank.
login is test / 1234
Thank you for checking
Comment #7
hass commentedFrom outside i cannot see anything wrong in the test user...
Comment #8
hass commentedOnly for debugging, could you place a
print '<pre>'; var_dump($fields); print '</pre>';one line before$segmentation = 'pageTracker._setVar('. drupal_to_js(implode(':', $fields)) .');';And a
print '<pre>'; var_dump($profile_fields); print '</pre>';beforeforeach ($profile_fields as $field => $title) {And a dump of
$pinto the file "googleanalytics.module" and post the results, please!?
Comment #9
sgriffin commentedAfter logging in I see
pageTracker._setVar("3940:test:::")
I should see
pageTracker._setVar("3940:test:Firstname Lastname:District:")
because on the ga admin page I have 4 things selected on user segmentation Userid , Username, Full_Name, and District.
Userid and Username are coming in fine, but Full_Name and District are resulting in the :::
Comment #10
hass commentedWhat type of profile fields are Full_Name and District?
Comment #11
sgriffin commentedsingle-line textfield
Output is
array(5) {
["uid"]=>
string(3) "uid"
["name"]=>
string(4) "name"
["profile_fullname"]=>
string(16) "profile_fullname"
["profile_district"]=>
string(16) "profile_district"
["profile_test2"]=>
string(13) "profile_test2"
}
array(5) {
["uid"]=>
string(4) "3940"
["name"]=>
string(4) "test"
["profile_fullname"]=>
NULL
["profile_district"]=>
NULL
["profile_test2"]=>
NULL
}
Comment #12
hass commentedVery strange... i tested single-line textfield myself, too.
Comment #13
hass commentedAs discussed by mail need info until you debugged your machine and install.
Comment #14
sgriffin commentedTested two servers with apache Apache/1.3.37
php 4.4.7
php 4.4.3
profile plus module is able to access the custom profile data and add it to /search
drupal lists the custom profile data on the user pages correctly
D6 Fresh install with no extra modules
D5 with many modules.
Both show the bug.
I guess a sql query could be made to access profile_values with the custom listed fields.
Comment #15
hass commentedYes, maybe devel module will help... look for profile_load_profile and then try to execute the SQL by hand and see what you get back
Comment #16
sgriffin commentedYes, if I put profile_load_profile($user); into the GA module the bug is fixed.
I placed it after line 40
Comment #17
hass commentedline 40? in D5 it should be 63 and in D6 line 97.
Comment #18
sgriffin commentedYes, I just put profile_load_profile($user); after global $user
But $p = profile_load_profile($user);
works also.
I guess we can close this one.. As to why module_invoke does not work as expected.. I'm not the right person to ask!
Comment #19
hass commentedAsk your hosting provider... could be something in apache/php or blocked functions/features, but i'm sure you will have many troubles if module_invoke is not working well.
Closing makes sense.
Comment #20
sgriffin commentedNo, there are 60 websites running php on those servers without issues. And about a dozen running drupal. This is the first issue I've traced down to module_invoke.