When I try to save Web Property ID on admin/config/system/googleanalytics page, it gives me this warning. But I have my UA code in format UA-xxxxxxx. I don't know what I should insert as "yy".

Could anybody help?

Files: 
CommentFileSizeAuthor
#17 googleanalytics.admin_.inc_.patch970 bytespverrier

Comments

Status:Active» Fixed

RTFM next to the input box.

Thanks:)
I got it:)

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Category:support» bug
Priority:Normal» Major
Status:Closed (fixed)» Active

Hi!
I have the same problem because my UA code is formatted as UA-xxxxxxx-y and not as UA-xxxxxxx-yy.

Any help will be must appreciated! Thanks!

Category:bug» support
Priority:Major» Normal
Status:Active» Closed (fixed)

There is no bug.

I have exactly the same problem !
The Google Analytics module refuse my UA.

I check in Google Analytics, in the "old interface".
I can check the status of my new site :

Code de suivi
Informations relatives à l'état du suivi
Nom du profil : sitename
URL du site Web : http://sitename.com
ID de site Web : UA-12345678-1
État du suivi : avertissement   Suivi non configuré (Dernière vérification : 24 janv. 2012 17:51:52 )
Le code de suivi Google Analytics n'a pas été détecté sur la page d'accueil de votre site Web. Pour que Google Analytics fonctionne, vous devez ajouter le code de suivi à toutes les pages de votre site. Vous pouvez l'ajouter vous-même ou par l'intermédiaire de votre administrateur Web.

So, my UA has a format UA- 8 numbers -1

Drupal give the error message :

Une Identité (ID) de Propriété Web Google Analytics valide est sensible à la casse et est formatée telle que UA-xxxxxxx-aa.

My UA is formated UA-xxxxxxxx-n !

I check in the javascript code generated by Google Analytics :

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-12345678-1']);
  _gaq.push(['_trackPageview']);

So, my UA is CORRECT but Drupal refuse it ...

UA-xxxxxxx-aa : requested by Drupal (7x-2)
UA-12345678-1 : provided by Google... (8x-1)

Thanks for your help.

;-)

<?php
if (!preg_match('/^UA-\d{4,}-\d+$/', $form_state['values']['googleanalytics_account'])) {
?>

Thanks Hass ;-)

Where must I put this PHP code ?

Thanks for your help.

Didier

This is the code that is used to verify ga codes for about 3-4 years and is 100% correct. Code wise, there is nothing wrong. There are 180.000 installations without any problem.

You may run a broken php version with preg_match bugs.

Thanks for reply Hass.

Our server is an Ubuntu 11.10 server, with standard LAMP installation.
I have other site and I check : other UA formats are accepted.

Strange...

If you can read the regex you would know that it validates for UA- followed by 4 or more (up to unlimited) digits, followed by a dash, followed by ONE or more (up to unlimited) digits.

Just to be sure did you paste the code from Google Analytics? If so, you have to change the two dashes, the copy and paste does not provide the right character.

You have no idea what you are talking about, isn't it? There is nothing to say any more.

@Alifbay thanks for your suggestion, I was trying to copy-paste my GA code from the Google interface since yesterday. Now I changed the dashes to normal ones and it worked perfectly.

The code was of form UA–XXXXXX–Y (wrong) instead of UA-XXXXXX-Y (good).

Had the same issue ; thanks Alifbay (#12), you're right !
Perhaps it will be useful to automatically replace these dashes by the good ones... I'm probably not the last to copy/paste and be blocked here...

Do you have a patch ready? :-)

StatusFileSize
new970 bytes

Here's a patch to automatically convert ndashes to normal ones.

Category:support» feature
Status:Closed (fixed)» Closed (duplicate)

Thank you #12 Alifbay: just so simple and both complicated ;)