Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi All,

    I was struggling with this, and other posts didn’t seem to resolve.

    Additionally, errors were very random, some of my sites work, some don’t. I was getting a “Uncaught ReferenceError: _gaq is not defined” when submitting (you can see this by opening the developer tools, console on google chrome)

    At the end I resolved by introducing the following code (Ref 1) on the Header, at the beginning, of the page where your contact form is, replacing the UA-XXXXXX-1 with your analytics code.

    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'https://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    </script>

    Then you can add the tracking code in the “Additional Settings” of the form, where you replace the /goals/enquiry-sent with whatever goal page you have defined (Ref 2):

    on_sent_ok: "_gaq.push(['_trackPageview', '/goals/enquiry-sent']);"

    This now works consistently across all my websites. Hope this helps!

    KR
    Siro

    References to above procedure:
    Ref 1) https://developers.google.com/analytics/devguides/collection/gajs/
    Ref 2) https://www.creare.co.uk/goal-tracking-contact-form-7

    Thread Starter Roundcape

    (@roundcape)

    OK, sorry, don’t know how to program.

    But thanks for pointing me in the right direction. Found a workaround by editing manually the countries.php file in /listo/modules.

    If helpful for other people, I resorted manually in excel and updated countries.php to contain the following: ct1 to ct9 include your custom countries, included them in the .un array, and the rest are sorted alphabetically by country name, instead of country 3 letter code.

    <?php
    /**
     * The list of countries and dependent territories based on ISO 3166 standard.
     *
     * Source: https://en.wikipedia.org/wiki/ISO_3166-1 ISO 3166-1
     */
    class Listo_Countries implements Listo {
    
    	private static $items = array(
    		'ct1' => "United Kingdom",
    		'ct2' => "United States",
    		'ct3' => "China",
    		'ct4' => "Turkey",
    		'ct5' => "India",
    		'ct6' => "Brazil",
    		'ct9' => " ——————— ",
    		'afg' => "Afghanistan",
    'ala' => "?land Islands",
    'alb' => "Albania",
    'dza' => "Algeria",
    'asm' => "American Samoa",
    'and' => "Andorra",
    'ago' => "Angola",
    'aia' => "Anguilla",
    'ata' => "Antarctica",
    'atg' => "Antigua and Barbuda",
    'arg' => "Argentina",
    'arm' => "Armenia",
    'abw' => "Aruba",
    'aus' => "Australia",
    'aut' => "Austria",
    'aze' => "Azerbaijan",
    'bhs' => "Bahamas",
    'bhr' => "Bahrain",
    'bgd' => "Bangladesh",
    'brb' => "Barbados",
    'blr' => "Belarus",
    'bel' => "Belgium",
    'blz' => "Belize",
    'ben' => "Benin",
    'bmu' => "Bermuda",
    'btn' => "Bhutan",
    'bol' => "Bolivia, Plurinational State of",
    'bes' => "Bonaire, Sint Eustatius and Saba",
    'bih' => "Bosnia and Herzegovina",
    'bwa' => "Botswana",
    'bvt' => "Bouvet Island",
    'bra' => "Brazil",
    'iot' => "British Indian Ocean Territory",
    'brn' => "Brunei Darussalam",
    'bgr' => "Bulgaria",
    'bfa' => "Burkina Faso",
    'bdi' => "Burundi",
    'khm' => "Cambodia",
    'cmr' => "Cameroon",
    'can' => "Canada",
    'cpv' => "Cape Verde",
    'cym' => "Cayman Islands",
    'caf' => "Central African Republic",
    'tcd' => "Chad",
    'chl' => "Chile",
    'chn' => "China",
    'cxr' => "Christmas Island",
    'cck' => "Cocos (Keeling) Islands",
    'col' => "Colombia",
    'com' => "Comoros",
    'cod' => "Congo, the Democratic Republic of the",
    'cog' => "Congo",
    'cok' => "Cook Islands",
    'cri' => "Costa Rica",
    'civ' => "C?te d'Ivoire",
    'hrv' => "Croatia",
    'cub' => "Cuba",
    'cuw' => "Cura?ao",
    'cyp' => "Cyprus",
    'cze' => "Czech Republic",
    'dnk' => "Denmark",
    'dji' => "Djibouti",
    'dma' => "Dominica",
    'dom' => "Dominican Republic",
    'ecu' => "Ecuador",
    'egy' => "Egypt",
    'slv' => "El Salvador",
    'gnq' => "Equatorial Guinea",
    'eri' => "Eritrea",
    'est' => "Estonia",
    'eth' => "Ethiopia",
    'flk' => "Falkland Islands (Malvinas)",
    'fro' => "Faroe Islands",
    'fji' => "Fiji",
    'fin' => "Finland",
    'fra' => "France",
    'guf' => "French Guiana",
    'pyf' => "French Polynesia",
    'atf' => "French Southern Territories",
    'gab' => "Gabon",
    'gmb' => "Gambia",
    'geo' => "Georgia",
    'deu' => "Germany",
    'gha' => "Ghana",
    'gib' => "Gibraltar",
    'grc' => "Greece",
    'grl' => "Greenland",
    'grd' => "Grenada",
    'glp' => "Guadeloupe",
    'gum' => "Guam",
    'gtm' => "Guatemala",
    'ggy' => "Guernsey",
    'gnb' => "Guinea-Bissau",
    'gin' => "Guinea",
    'guy' => "Guyana",
    'hti' => "Haiti",
    'hmd' => "Heard Island and McDonald Islands",
    'vat' => "Holy See (Vatican City State)",
    'hnd' => "Honduras",
    'hkg' => "Hong Kong",
    'hun' => "Hungary",
    'isl' => "Iceland",
    'ind' => "India",
    'idn' => "Indonesia",
    'irn' => "Iran, Islamic Republic of",
    'irq' => "Iraq",
    'irl' => "Ireland",
    'imn' => "Isle of Man",
    'isr' => "Israel",
    'ita' => "Italy",
    'jam' => "Jamaica",
    'jpn' => "Japan",
    'jey' => "Jersey",
    'jor' => "Jordan",
    'kaz' => "Kazakhstan",
    'ken' => "Kenya",
    'kir' => "Kiribati",
    'prk' => "Korea, Democratic People's Republic of",
    'kor' => "Korea, Republic of",
    'kwt' => "Kuwait",
    'kgz' => "Kyrgyzstan",
    'lao' => "Lao People's Democratic Republic",
    'lva' => "Latvia",
    'lbn' => "Lebanon",
    'lso' => "Lesotho",
    'lbr' => "Liberia",
    'lby' => "Libya",
    'lie' => "Liechtenstein",
    'ltu' => "Lithuania",
    'lux' => "Luxembourg",
    'mac' => "Macao",
    'mkd' => "Macedonia, the former Yugoslav Republic of",
    'mdg' => "Madagascar",
    'mwi' => "Malawi",
    'mys' => "Malaysia",
    'mdv' => "Maldives",
    'mli' => "Mali",
    'mlt' => "Malta",
    'mhl' => "Marshall Islands",
    'mtq' => "Martinique",
    'mrt' => "Mauritania",
    'mus' => "Mauritius",
    'myt' => "Mayotte",
    'mex' => "Mexico",
    'fsm' => "Micronesia, Federated States of",
    'mda' => "Moldova, Republic of",
    'mco' => "Monaco",
    'mng' => "Mongolia",
    'mne' => "Montenegro",
    'msr' => "Montserrat",
    'mar' => "Morocco",
    'moz' => "Mozambique",
    'mmr' => "Myanmar",
    'nam' => "Namibia",
    'nru' => "Nauru",
    'npl' => "Nepal",
    'nld' => "Netherlands",
    'ncl' => "New Caledonia",
    'nzl' => "New Zealand",
    'nic' => "Nicaragua",
    'ner' => "Niger",
    'nga' => "Nigeria",
    'niu' => "Niue",
    'nfk' => "Norfolk Island",
    'mnp' => "Northern Mariana Islands",
    'nor' => "Norway",
    'omn' => "Oman",
    'pak' => "Pakistan",
    'plw' => "Palau",
    'pse' => "Palestine, State of",
    'pan' => "Panama",
    'png' => "Papua New Guinea",
    'pry' => "Paraguay",
    'per' => "Peru",
    'phl' => "Philippines",
    'pcn' => "Pitcairn",
    'pol' => "Poland",
    'prt' => "Portugal",
    'pri' => "Puerto Rico",
    'qat' => "Qatar",
    'reu' => "Réunion",
    'rou' => "Romania",
    'rus' => "Russian Federation",
    'rwa' => "Rwanda",
    'blm' => "Saint Barthélemy",
    'shn' => "Saint Helena, Ascension and Tristan da Cunha",
    'kna' => "Saint Kitts and Nevis",
    'lca' => "Saint Lucia",
    'maf' => "Saint Martin (French part)",
    'spm' => "Saint Pierre and Miquelon",
    'vct' => "Saint Vincent and the Grenadines",
    'wsm' => "Samoa",
    'smr' => "San Marino",
    'stp' => "Sao Tome and Principe",
    'sau' => "Saudi Arabia",
    'sen' => "Senegal",
    'srb' => "Serbia",
    'syc' => "Seychelles",
    'sle' => "Sierra Leone",
    'sgp' => "Singapore",
    'sxm' => "Sint Maarten (Dutch part)",
    'svk' => "Slovakia",
    'svn' => "Slovenia",
    'slb' => "Solomon Islands",
    'som' => "Somalia",
    'zaf' => "South Africa",
    'sgs' => "South Georgia and the South Sandwich Islands",
    'ssd' => "South Sudan",
    'esp' => "Spain",
    'lka' => "Sri Lanka",
    'sdn' => "Sudan",
    'sur' => "Suriname",
    'sjm' => "Svalbard and Jan Mayen",
    'swz' => "Swaziland",
    'swe' => "Sweden",
    'che' => "Switzerland",
    'syr' => "Syrian Arab Republic",
    'twn' => "Taiwan, Province of China",
    'tjk' => "Tajikistan",
    'tza' => "Tanzania, United Republic of",
    'tha' => "Thailand",
    'tls' => "Timor-Leste",
    'tgo' => "Togo",
    'tkl' => "Tokelau",
    'ton' => "Tonga",
    'tto' => "Trinidad and Tobago",
    'tun' => "Tunisia",
    'tur' => "Turkey",
    'tkm' => "Turkmenistan",
    'tca' => "Turks and Caicos Islands",
    'tuv' => "Tuvalu",
    'uga' => "Uganda",
    'ukr' => "Ukraine",
    'are' => "United Arab Emirates",
    'gbr' => "United Kingdom",
    'umi' => "United States Minor Outlying Islands",
    'usa' => "United States",
    'ury' => "Uruguay",
    'uzb' => "Uzbekistan",
    'vut' => "Vanuatu",
    'ven' => "Venezuela, Bolivarian Republic of",
    'vnm' => "Viet Nam",
    'vgb' => "Virgin Islands, British",
    'vir' => "Virgin Islands, U.S.",
    'wlf' => "Wallis and Futuna",
    'esh' => "Western Sahara",
    'yem' => "Yemen",
    'zmb' => "Zambia",
    'zwe' => "Zimbabwe");
    
    	private static $groups = array(
    		'un' => array( 'ct1', 'ct2', 'ct3', 'ct4', 'ct5', 'ct6', 'ct7', 'ct8', 'ct9', 'ago', 'afg', 'alb', 'and', 'are', 'arg', 'arm',
    			'atg', 'aus', 'aut', 'aze', 'bdi', 'bel', 'ben', 'bfa', 'bgd',
    			'bgr', 'bhr', 'bhs', 'bih', 'blr', 'blz', 'bol', 'bra', 'brb',
    			'brn', 'btn', 'bwa', 'caf', 'can', 'che', 'chl', 'chn', 'civ',
    			'cmr', 'cod', 'cog', 'col', 'com', 'cpv', 'cri', 'cub', 'cyp',
    			'cze', 'deu', 'dji', 'dma', 'dnk', 'dom', 'dza', 'ecu', 'egy',
    			'eri', 'esp', 'est', 'eth', 'fin', 'fji', 'fra', 'fsm', 'gab',
    			'gbr', 'geo', 'gha', 'gin', 'gmb', 'gnb', 'gnq', 'grc', 'grd',
    			'gtm', 'guy', 'hnd', 'hrv', 'hti', 'hun', 'idn', 'ind', 'irl',
    			'irn', 'irq', 'isl', 'isr', 'ita', 'jam', 'jor', 'jpn', 'kaz',
    			'ken', 'kgz', 'khm', 'kir', 'kna', 'kor', 'kwt', 'lao', 'lbn',
    			'lbr', 'lby', 'lca', 'lie', 'lka', 'lso', 'ltu', 'lux', 'lva',
    			'mar', 'mco', 'mda', 'mdg', 'mdv', 'mex', 'mhl', 'mkd', 'mli',
    			'mlt', 'mmr', 'mne', 'mng', 'moz', 'mrt', 'mus', 'mwi', 'mys',
    			'nam', 'ner', 'nga', 'nic', 'nld', 'nor', 'npl', 'nru', 'nzl',
    			'omn', 'pak', 'pan', 'per', 'phl', 'plw', 'png', 'pol', 'prk',
    			'prt', 'pry', 'qat', 'rou', 'rus', 'rwa', 'sau', 'sdn', 'sen',
    			'sgp', 'slb', 'sle', 'slv', 'smr', 'som', 'srb', 'ssd', 'stp',
    			'sur', 'svk', 'svn', 'swe', 'swz', 'syc', 'syr', 'tcd', 'tgo',
    			'tha', 'tjk', 'tkm', 'tls', 'ton', 'tto', 'tun', 'tur', 'tuv',
    			'tza', 'uga', 'ukr', 'ury', 'usa', 'uzb', 'vct', 'ven', 'vnm',
    			'vut', 'wsm', 'yem', 'zaf', 'zmb', 'zwe' ),
    		'olympic' => array( 'abw', 'afg', 'ago', 'alb', 'and', 'are', 'arg',
    			'arm', 'asm', 'atg', 'aus', 'aut', 'aze', 'bdi', 'bel', 'ben',
    			'bfa', 'bgd', 'bgr', 'bhr', 'bhs', 'bih', 'blr', 'blz', 'bmu',
    			'bol', 'bra', 'brb', 'brn', 'btn', 'bwa', 'caf', 'can', 'che',
    			'chl', 'chn', 'civ', 'cmr', 'cod', 'cog', 'cok', 'col', 'com',
    			'cpv', 'cri', 'cub', 'cym', 'cyp', 'cze', 'deu', 'dji', 'dma',
    			'dnk', 'dom', 'dza', 'ecu', 'egy', 'eri', 'esp', 'est', 'eth',
    			'fin', 'fji', 'fra', 'fsm', 'gab', 'gbr', 'geo', 'gha', 'gin',
    			'gmb', 'gnb', 'gnq', 'grc', 'grd', 'gtm', 'gum', 'guy', 'hkg',
    			'hnd', 'hrv', 'hti', 'hun', 'idn', 'ind', 'irl', 'irn', 'irq',
    			'isl', 'isr', 'ita', 'jam', 'jor', 'jpn', 'kaz', 'ken', 'kgz',
    			'khm', 'kir', 'kna', 'kor', 'kwt', 'lao', 'lbn', 'lbr', 'lby',
    			'lca', 'lie', 'lka', 'lso', 'ltu', 'lux', 'lva', 'mar', 'mco',
    			'mda', 'mdg', 'mdv', 'mex', 'mhl', 'mkd', 'mli', 'mlt', 'mmr',
    			'mne', 'mng', 'moz', 'mrt', 'mus', 'mwi', 'mys', 'nam', 'ner',
    			'nga', 'nic', 'nld', 'nor', 'npl', 'nru', 'nzl', 'omn', 'pak',
    			'pan', 'per', 'phl', 'plw', 'png', 'pol', 'pri', 'prk', 'prt',
    			'pry', 'pse', 'qat', 'rou', 'rus', 'rwa', 'sau', 'sdn', 'sen',
    			'sgp', 'slb', 'sle', 'slv', 'smr', 'som', 'srb', 'stp', 'sur',
    			'svk', 'svn', 'swe', 'swz', 'syc', 'syr', 'tcd', 'tgo', 'tha',
    			'tjk', 'tkm', 'tls', 'ton', 'tto', 'tun', 'tur', 'tuv', 'twn',
    			'tza', 'uga', 'ukr', 'ury', 'usa', 'uzb', 'vct', 'ven', 'vir',
    			'vnm', 'vut', 'wsm', 'yem', 'zaf', 'zmb', 'zwe' ) );
    
    	private function __construct() {}
    
    	public static function items() {
    		return self::$items;
    	}
    
    	public static function groups() {
    		return self::$groups;
    	}
    
    }
    
    ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

Viewing 2 replies - 1 through 2 (of 2 total)