Commit 5ba7aaba authored by hass's avatar hass
Browse files

#1509610: Invalid dashes in UA–xxxxxxxx–y cannot copied & pasted from

Google Analytics website
parent 47809f7a
......@@ -430,6 +430,9 @@ function googleanalytics_admin_settings_form_validate($form, &$form_state) {
$form_state['values']['googleanalytics_codesnippet_before'] = trim($form_state['values']['googleanalytics_codesnippet_before']);
$form_state['values']['googleanalytics_codesnippet_after'] = trim($form_state['values']['googleanalytics_codesnippet_after']);
// Replace all type of dashes (n-dash, m-dash, minus) with the normal dashes.
$form_state['values']['googleanalytics_account'] = str_replace(array('–', '—', '−'), '-', $form_state['values']['googleanalytics_account']);
if (!preg_match('/^UA-\d{4,}-\d+$/', $form_state['values']['googleanalytics_account'])) {
form_set_error('googleanalytics_account', t('A valid Google Analytics Web Property ID is case sensitive and formatted like UA-xxxxxxx-yy.'));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment