Google Pixel 4 XL review: Half great, half-baked

Google has packed its newest handset with an array of cutting-edge tech, but it falls short of being a great phone

The Google Pixel 4 XL can lay claim to the only real smartphone breakthrough of the year: a shrunken radar chip that is so advanced it can detect when you reach for your phone so you will never have to stare at a blank screen.

It is a delightful feature that makes ambient or always-on displays seem old hat. Combined with Face unlock, the Pixel 4’s Motion Sense technology makes me feel like the phone anticipates all my moves, and this truly saves time by limiting how often I need to tap the screen. Before you even unlock it, the Pixel 4 XL exudes futurity and sets you up for an experience unlike anything you’ll find on a Galaxy or iPhone.

Unfortunately, the rest of the Pixel 4’s innovations are still several software updates away. Once you get past the lock screen, the Pixel 4 XL is basically an iterative upgrade over the Pixel 3 – which is still for sale, and for hundreds of dollars less. The new model introduces features that need more time to bake, a few shortcomings that should have been fixed before launch, and a camera that is not impressive when compared to the competition. Google may have delivered its most ambitious phone with the Pixel 4 XL, but it falls well short of nailing a top-tier phone experience.

 

advertisement

 

Design: Taking the fun out of functional

Like the Google and Nexus phones that came before it, the Pixel 4 XL is a bland, perfunctory handset that looks downright ugly next to the Galaxy Note 10+ or iPhone 11 Pro. While other phone makers are racing to be the first with a 100% screen-to-body ratio, the Pixel 4 is nearly 20% bezel and extremely top-heavy to boot.

There’s no notch on the Pixel 4 XL (front), but the bezel is very much still there.

Gone is the Pixel 3’s laughably large notch, but in its place is a bezel that is straight out of 2016. No fewer than seven sensors and a speaker occupy the space above the screen, but all you’ll see is an unsightly strip of black glass. The sizable top bezel extends to the sides and the bottom, where there is no balance or symmetry. It is small enough to push the speaker to the bottom edge, and from afar, the Pixel 4 will look more like a budget phone than a premium one. Even up close, there is nothing about it that looks like it should cost $900.

Around the back you will find the Pixel 4’s most obvious upgrade: a dual camera. Like the iPhone 11, the Pixel 4 has a giant square camera array in the top left corner that is designed to stand out, particularly in white or orange. However, while the camera array is very much a fluid part of the iPhone 11 despite its size, the Pixel 4’s camera bump feels like an afterthought that was tacked on after the phone’s design was already finished.

The orange power button on the Pixel 4 XL is my favourite design element.

That said, the Pixel 4 has the nicest hand feel of any phone I have ever used. From the frosted glass back to the polished aluminium sides, there is not a speck of gloss apart from the front and the ‘G’ logo. The visual and tactile contrast is palpable. The back is practically silky to the touch, giving the Pixel 4 an even more luxurious feel than the iPhone 11 Pro, and it is remarkably resistant to scuffs, smudges, and scratches. But my favourite design element continues to be the coloured power button, which is orange on the white model I tested. It is subtle, but it adds a bit of whimsy to an otherwise staid and, ahem, buttoned-up design.

The Pixel 4 does not include a headphone jack, which is not a surprise, but it also does not come with a pair of USB-C earbuds or a 3.5mm adapter, which is a bit shocking. The Pixel 3, Galaxy S10, and iPhone 11 all come with an audio contingency plan.

Face Unlock: Quick and accurate with little support

The Pixel 4 brings a handful of new features that set it apart from both the Pixel 3 and Google’s 2019 competitors, and they are all designed to enhance your daily smartphone routine without much adjustment or re-learning.

Let’s start with Face Unlock. Where virtually every other Android phone relies on a fingerprint sensor to keep your phone locked from prying eyes, the Pixel 4 has a 3D camera for secure facial recognition. It is something no other US Android phone has, and only the LG G8 with its time-of-flight sensor has something similar. That means after more than two years there is finally an Android Phone that can rival Apple’s TrueDepth camera and Face ID.

The Pixel 4 XL’s top bezel hides an array of tech, including 3D  facial recognition.

It works really well. While Face Unlock on the Pixel 4 requires more precise positioning than Face ID on the iPhone 11, for a first-gen feature, I was impressed. It works on the first try better than 95% of the time, and it offers some subtle improvements over Apple’s method. For one, there’s a small bit of haptic feedback to let you know it works, so you can stop holding your phone up. And there is an option to let you skip right to the home screen once it recognises your face, saving a swipe and making the whole system feel far quicker and more integrated.

However, there is a big caveat to Face Unlock: It is less secure than Apple’s Face ID. Face Unlock does not track your eyes, so someone could conceivably hold your Pixel 4 up to your face while you are sleeping and unlock it. That is not as big of a vulnerability as a third-party screen protector giving you access to the Galaxy S10, but it should raise some eyebrows.

As the phone’s only biometric-based unlocking method, one would think Google would have made it as fool proof as possible. As it stands, Google has issued a vague promise to update it “in the coming months.” In an age of privacy and security, it is a glaring omission in an otherwise welcome feature.

Equally frustrating is Face Unlock’s lack of app support. Since Google has taken away the fingerprint sensor, you are going to be typing your password a lot because only a small handful of apps (including Chrome and Google Pay, naturally) have signed on to support it. That’s a major step backward, and given Android’s history, we’re not convinced those app updates will arrive in a timely fashion.

Motion Sense: Good now, better later (maybe)

The Pixel 4’s most unique feature is a miniaturised radar chip that powers the gesture-based Motion Sense. It works far better than similar features in other phones, but just like Face Unlock, it is an update or two away from being truly useful.

Even without a notch, the Pixel 4 XL (right) is essentially the size as the Pixel 3 XL. But the new phone has some futuristic tech in the top bezel.

Motion Sense is the first real breakthrough for a smartphone in years. It works without an app or any real instructions, and the learning curve is easy enough to be mastered in seconds. Basically, you’re interacting with your phone’s screen the way Tony Stark uses a virtual screen to create the Iron Man suit: swipes and waves rather than taps and pinches.

Here’s what it can do:

  • Detect when you reach for your phone and light up the lock screen.
  • Skip to the next or previous track.
  • Snooze an alarm.
  • Dismiss a timer.
  • Silence the ringtone on an incoming call.

That’s it. You can’t raise the volume, pause a song, hang up on an incoming call, dismiss a notification, launch an app, flip the camera, take a picture, or anything else you could conceivably want to do without touching your phone. As it stands, Motion Sense is extremely limited and not very useful – a neat trick in search of a party.

New Assistant: Great if you can get it

The Pixel 4 is also the showcase for the new Google Assistant; a streamlined interface and a faster response time. I did not get anywhere near the rapid-fire speed that was demoed at Google I/O in May, but it has improved.

The new Assistant interface is the bigger story. It is better than any other AI chatbot, including Assistant on other devices. Instead of a window that takes over part (or all) of your screen, Assistant occupies a tiny space at the bottom of the display that will only expand to show you what you need to see. With Continued Conversation enabled, you will be able to ask follow-up questions in quick succession. I did not experience any issues with it understanding me, though issues are rare with the old Assistant.

The new Assistant on the Pixel 4 is faster and less intrusive.

The new interface only works if you have gesture navigation enabled. I assume that is because the navigation bar gets in the way, but that is a weird requirement since Android 10 is keeping the old method around.

Even more confounding is the new Assistant’s inability to play nicely with G Suite for Business accounts that are separate from whatever Google account you set for the phone’s main profile. Even if there is a dormant secondary G Suite account on your phone, it will block the new Assistant. It will not appear unless the second account is completely removed. G Suite users might not even realise they are missing anything, which is unacceptable for a major feature on a thousand-dollar phone.

The Pixel 4 showcases Android 10’s newest features; notably dark mode and gesture navigation. Pixel users may be familiar with Android’s gestures, but it is a bit different here. The pill and back buttons are replaced with an iOS-style action bar – it is a little and clunky and not nearly as intuitive as it is on the iPhone, particularly when it comes to the back gesture. You are supposed to be able to swipe from the left or right edge to go back a screen, but sometimes menus get in the way. All in all, it still needs work. Dark mode, on the other hand, is far more refined, nearly every Google app and system screen supports it.

But my favourite feature is Live Caption. When it is turned on, any video from any source will automatically transcribe captions based on what is playing, and it is surprisingly spot on most of the time. The same goes for the excellent new Recorder app, which will record and transcribe the words it hears. Neither is perfect, but they are both incredibly useful and sure to improve quickly thanks to a healthy dose of machine learning and AI smarts. I assume both features will eventually be available on other Pixel and Android phones, but for now they are exclusive to the Pixel 4.

Performance: A good display, OK everything else 

Strip away the new features, and the Pixel 4 XL trails its peer a bit on the spec sheet, with the RAM, storage, and battery all on the skimpy side:

  • Display: 6.3″ QHD+ OLED, 537ppi
  • Processor: Snapdragon 855
  • RAM: 6Gb
  • Storage: 64Gb/128Gb
  • Battery: 3,700mAh

The Pixel 4 is plenty fast, but a phone launching so late in 2019 really should be using the 855+ chip. While Google has finally admitted that 4Gb of RAM just does not cut it for a high-end Android phone anymore, 6Gb is not so great either. Compared to the Pixel 3, my Pixel 4 kept a few more apps in its Recents carousel, but neither holds a candle to the dozens that were visible on the S10+. Plus, Google is still charging $100 for an extra 64Gb of storage? Even Apple charges half that.

Google finally delivered an excellent smartphone screen in the Pixel 4 XL, even if the 90Hz Smooth Display isn’t all that.

Google shines in its new display game. It is still not quite as bright as the Note 10+ or as vibrant as the iPhone 11 Pro, but the display on the Pixel 4 is easily the best Google has delivered. The blacks are deeper and the colours more vibrant than the Pixel 3. The oleophobic smudges that plagued earlier models are nowhere to be seen. I liked the new Ambient EQ feature that adjusts the white balance based on the light in the room. Like Apple’s True Tone display, it makes the screen easier on the eyes without jarring auto-brightness adjustments.

The Pixel 4 introduced Smooth Display, which ups the refresh rate to 90Hz for smoother and speedier scrolling and swiping. The difference here is not as immediately obvious over the Pixel 3 or even switching between 60Hz or 90Hz in the settings. That is somewhat due to the Pixel’s natural hardware-software integration, but also because it only turns on if your brightness is greater than 75%, another limitation that Google fails to advertise. There were times when I could not tell whether Smooth Display was on or off, even at max brightness. Google says it will be updating Smooth Display “in the coming weeks”.

With all the bells and whistles on, the Pixel 4 XL has extremely average battery life for a phone in this price range. Benchmarks pegged the Pixel 4 XL at around nine hours, and I was able to get through most days with Smooth Display and Motion Sense switched on. However, the battery was more of a constant concern than with the iPhone 11, Galaxy Note 10+, or OnePlus 7T, and I was acutely aware of how much I had left. I did a little better with Smooth Display and Motion Sense switched off, but it was not a dramatic improvement – and besides, that kind of defeats the purpose of buying a Pixel 4 in the first place. With the kind of battery advancements Apple and Samsung are making with their phones, Google’s Pixel optimisations are woefully behind the times.

Thankfully, Google seems to be acutely aware of the Pixel 4’s battery issues, so it is amped up its wireless charging capabilities. While Google basically forced you to buy a Pixel Stand to get fast wireless charging on the Pixel 3, the Pixel 4 delivers 11W charging with any compatible charger. That’s not as fast as the Galaxy S10’s 15W wireless capabilities, but it is a huge step up from the Pixel 3’s lame 5W offering.

Camera: A second lens makes little difference

If you are in the market for a new Pixel, the camera is likely the number one reason why. Google built the Pixel name on the strength of its camera, and the fourth version only drives that point home. After telling us for years that a single camera was all you needed, Google has added a second camera to the rear of the phone, marrying a 16MP telephoto lens with the 12.2MP standard wide lens.

The Pixel 4 XL brings a second rear camera this year.

Perhaps Google was right all along. Since previous Pixels have been able to achieve such incredible results with just one lens, the addition of a second lens brings expected rather than exceptional results. The Pixel 4’s camera improvements are largely incremental and not nearly as impressive as previous models. New features such as astral photography mode and dual exposure are fun to experiment with, but ultimately will not be used all that often, and live HDR is more overdue than revolutionary.

In this image of a rainbow-tinted knife, the Pixel 4 (left) mutes the colours of both the floor and the blade, while the iPhone 11 (centre) and Pixel 3 XL (right) handle them properly.

That is not to say it does not take great pics. But so did the Pixel 3. And so do the Galaxy S10 and the iPhone 11. In some tests, the Pixel 4 XL bested its competition and in others, it performed on par. In some, it missed the mark. Take the photo of the knife above. The Pixel 3 XL got the floor colour right, while the iPhone excelled at capturing the rainbow pattern in the blade. The Pixel 4 XL’s shot is on the dull side, muting the colours throughout and stripping away the character. The same is true of the skull below, though the Pixel 4 was the only one of the three to maintain the proper colour of the wall.

The Pixel 4 XL (left) shifted the white balance, which dulled the colours a bit, while the Pixel 3 XL (right) was a little closer but still too blue. The iPhone 11 (centre) was the most accurate. 

Most surprising, however, is the telephoto’s lens lack of an impact on either zooming or portraits. I thought that the addition of a second telephoto lens would make a huge difference over the Pixel 3, especially after Google’s proclamation that it was more important than an ultra-wide lens. But in straight comparisons, I did not see much of a difference. In the portrait photo below, it is impossible to see the difference between the Pixel 3 and the Pixel 4, even if you zoom in. If anything, the Pixel 3 does a slightly better job with handling skin tones and colour.

These portraits taken with the Pixel 4 XL (left) and the Pixel 3 XL (right) are extremely similar.

And in this photo below, the Pixel 3’s digital zoom is basically just as good as the Pixel 4’s 2X optical zoom. In fact, if you inspect the Pixel 4 image, you can see some weird colours and graininess on the back wall and the mantle that do not appear in the Pixel 3’s shot.

Despite its 2X optical zoom lens, the Pixel 4 XL (left) struggled with this zoomed image, adding artefacts to the mantle and some noise to the back wall, while the Pixel 3 XL’s digital zoom handled it correctly.

The Pixel 3 impressed with Night Sight last year, but Google’s competitors have caught up fast and exposed its weaknesses. The iPhone 11’s Night mode bests the Pixel 4 in just about every situation. The biggest problem is the Pixel’s tendency to brighten everything, which often undermines the nuance and integrity of the scene. Apple’s method consistently preserved shadows and lowlights that were lost or washed out by the Pixel. The both did an admirable job, but the iPhone was consistently just a little better, as you can plainly see in the photo below.

Both the Pixel 4 (left) and iPhone 11 (right) brightened this super-dark nighttime scene, but Apple retains the shadows and spookiness while Google blows out the ambience a bit.

That is kind of the story with the Pixel 4. While the Pixel 3’s camera put the rest of the smartphone industry on notice, the Pixel 4 shows that Google might not have been prepared for Samsung and Apple to catch up so quickly. (That is not to say anything about its inability to record 4K video at 60fps.)

I might be picking nits here and sharing photos that specifically highlight the Pixel 4’s shortcomings, but the fact remains that Google’s competitors have all but closed the gap with their own computational photography systems, and Google’s improvements over the Pixel 3 XL are slight. I would assume that anyone who buys a Pixel 4 cares about such subtleties. So while you will surely be able to take excellent, gallery-worthy photos with very little effort with the Pixel 4, if you are looking for another generational leap, you are going to be disappointed.

Should you buy a Google Pixel 4 XL?

The latest Pixel phone is usually an easy recommendation, but this year’s phone is a bit of a conundrum. So, I would say that now is not the time to buy a Pixel 4.

The Face Unlock and Google Assistant bugs are too glaring to overlook, and Motion Sense is in desperate need of new features. The camera is still one of the best, but the gap between it and its peers is practically non-existent, and its tricks are not nearly as impressive with a second lens. And the specs are downright blah for a $900 phone. Even the Pixel launcher and the promise of three years of Android updates are less of a reason to buy, as Samsung ups its game with One UI.

The Pixel 4 has more untapped potential many other phones, but it fails at its most important job: being a phone that lives up to its own hype – and price.

Michael Simon, IDG News Service

RELATED ARTICLES
#mc_embed_signup{background:#fff; false;clear:left; font:14px Helvetica,Arial,sans-serif; width: px;} /* Add your own Mailchimp form style overrides in your site stylesheet or in this style block. We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
Sign up for the
Technology Minute
(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[0]='EMAIL';ftypes[0]='email';fnames[1]='FNAME';ftypes[1]='text';fnames[2]='MMERGE2';ftypes[2]='text';fnames[3]='MMERGE3';ftypes[3]='text';fnames[4]='MMERGE4';ftypes[4]='text';fnames[5]='SIGNUP';ftypes[5]='text';fnames[6]='MMERGE6';ftypes[6]='imageurl';}(jQuery));var $mcj = jQuery.noConflict(true); // SMS Phone Multi-Country Functionality if(!window.MC) { window.MC = {}; } window.MC.smsPhoneData = { defaultCountryCode: 'IE', programs: [], smsProgramDataCountryNames: [] }; function getCountryUnicodeFlag(countryCode) { return countryCode.toUpperCase().replace(/./g, (char) => String.fromCodePoint(char.charCodeAt(0) + 127397)) }; // HTML sanitization function to prevent XSS function sanitizeHtml(str) { if (typeof str !== 'string') return ''; return str .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, ''') .replace(/\//g, '/'); } // URL sanitization function to prevent javascript: and data: URLs function sanitizeUrl(url) { if (typeof url !== 'string') return ''; const trimmedUrl = url.trim().toLowerCase(); if (trimmedUrl.startsWith('javascript:') || trimmedUrl.startsWith('data:') || trimmedUrl.startsWith('vbscript:')) { return '#'; } return url; } const getBrowserLanguage = () => { if (!window?.navigator?.language?.split('-')[1]) { return window?.navigator?.language?.toUpperCase(); } return window?.navigator?.language?.split('-')[1]; }; // getBrowserLanguageCode() and getSmsProgramForCountryAndLanguage() are provided globally // by the external mc-sms-phone.js script loaded alongside this inline form script. function getDefaultCountryProgram(defaultCountryCode, smsProgramData) { if (!smsProgramData || smsProgramData.length === 0) { return null; } var browserCountryCode = getBrowserLanguage(); var browserLangCode = getBrowserLanguageCode(); if (browserCountryCode) { var match = getSmsProgramForCountryAndLanguage(smsProgramData, browserCountryCode, browserLangCode); if (match) { return match; } } if (defaultCountryCode) { var match = getSmsProgramForCountryAndLanguage(smsProgramData, defaultCountryCode, browserLangCode); if (match) { return match; } } return smsProgramData[0]; } function updateSmsLegalText(countryCode, fieldName) { if (!countryCode || !fieldName) { return; } var programs = window?.MC?.smsPhoneData?.programs; if (!programs || !Array.isArray(programs)) { return; } var browserLangCode = getBrowserLanguageCode(); var program = getSmsProgramForCountryAndLanguage(programs, countryCode, browserLangCode); if (!program || !program.requiredTemplate) { return; } var smsConsentHtmlRenderingFixEnabled = true; const legalTextElement = document.querySelector('#legal-text-' + fieldName); if (!legalTextElement) { return; } const divRegex = new RegExp(']*>', 'gi'); const blockWrapperRegex = new RegExp(']*>', 'gi'); const fullAnchorRegex = new RegExp('<a.*?', 'g'); const anchorRegex = new RegExp('(.*?)'); const template = smsConsentHtmlRenderingFixEnabled ? program.requiredTemplate .replace(/\s*

]*>/gi, ' ') .replace(blockWrapperRegex, '') : program.requiredTemplate.replace(divRegex, ''); legalTextElement.textContent = ''; const parts = template.split(/(.*?)/g); parts.forEach(function(part) { if (!part) { return; } const anchorMatch = part.match(/(.+?)/); if (anchorMatch) { const linkElement = document.createElement('a'); linkElement.href = sanitizeUrl(anchorMatch[1]); linkElement.target = anchorMatch[2] ? sanitizeHtml(anchorMatch[2]) : '_blank'; linkElement.rel = 'noopener noreferrer'; linkElement.textContent = sanitizeHtml(anchorMatch[3]); legalTextElement.appendChild(linkElement); } else { legalTextElement.appendChild(document.createTextNode(part)); } }); } function generateDropdownOptions(smsProgramData) { if (!smsProgramData || smsProgramData.length === 0) { return ''; } var programs = true ? smsProgramData.filter(function(p, i, arr) { return arr.findIndex(function(q) { return q.countryCode === p.countryCode; }) === i; }) : smsProgramData; return programs.map(program => { const flag = getCountryUnicodeFlag(program.countryCode); const countryName = getCountryName(program.countryCode); const callingCode = program.countryCallingCode || ''; // Sanitize all values to prevent XSS const sanitizedCountryCode = sanitizeHtml(program.countryCode || ''); const sanitizedCountryName = sanitizeHtml(countryName || ''); const sanitizedCallingCode = sanitizeHtml(callingCode || ''); return '' + sanitizedCountryName + ' ' + sanitizedCallingCode + ''; }).join(''); } function getCountryName(countryCode) { if (window.MC?.smsPhoneData?.smsProgramDataCountryNames && Array.isArray(window.MC.smsPhoneData.smsProgramDataCountryNames)) { for (let i = 0; i < window.MC.smsPhoneData.smsProgramDataCountryNames.length; i++) { if (window.MC.smsPhoneData.smsProgramDataCountryNames[i].code === countryCode) { return window.MC.smsPhoneData.smsProgramDataCountryNames[i].name; } } } return countryCode; } function getDefaultPlaceholder(countryCode) { if (!countryCode || typeof countryCode !== 'string') { return '+1 000 000 0000'; // Default US placeholder } var mockPlaceholders = [ { countryCode: 'US', placeholder: '+1 000 000 0000', helpText: 'Include the US country code +1 before the phone number', }, { countryCode: 'GB', placeholder: '+44 0000 000000', helpText: 'Include the GB country code +44 before the phone number', }, { countryCode: 'CA', placeholder: '+1 000 000 0000', helpText: 'Include the CA country code +1 before the phone number', }, { countryCode: 'AU', placeholder: '+61 000 000 000', helpText: 'Include the AU country code +61 before the phone number', }, { countryCode: 'DE', placeholder: '+49 000 0000000', helpText: 'Fügen Sie vor der Telefonnummer die DE-Ländervorwahl +49 ein', }, { countryCode: 'FR', placeholder: '+33 0 00 00 00 00', helpText: 'Incluez le code pays FR +33 avant le numéro de téléphone', }, { countryCode: 'ES', placeholder: '+34 000 000 000', helpText: 'Incluya el código de país ES +34 antes del número de teléfono', }, { countryCode: 'NL', placeholder: '+31 0 00000000', helpText: 'Voeg de NL-landcode +31 toe vóór het telefoonnummer', }, { countryCode: 'BE', placeholder: '+32 000 00 00 00', helpText: 'Incluez le code pays BE +32 avant le numéro de téléphone', }, { countryCode: 'CH', placeholder: '+41 00 000 00 00', helpText: 'Fügen Sie vor der Telefonnummer die CH-Ländervorwahl +41 ein', }, { countryCode: 'AT', placeholder: '+43 000 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die AT-Ländervorwahl +43 ein', }, { countryCode: 'IE', placeholder: '+353 00 000 0000', helpText: 'Include the IE country code +353 before the phone number', }, { countryCode: 'IT', placeholder: '+39 000 000 0000', helpText: 'Includere il prefisso internazionale IT +39 prima del numero di telefono', }, { countryCode: 'NO', placeholder: '+47 000 00 000', helpText: 'Inkluder NO landskode +47 før telefonnummeret', }, { countryCode: 'SE', placeholder: '+46 00 000 00 00', helpText: 'Inkludera SE landskod +46 före telefonnumret', }, { countryCode: 'DK', placeholder: '+45 00 00 00 00', helpText: 'Inkluder DK landekode +45 før telefonnummeret', }, { countryCode: 'FI', placeholder: '+358 00 000 0000', helpText: 'Sisällytä FI-maakoodi +358 ennen puhelinnumeroa', }, { countryCode: 'EE', placeholder: '+372 0000 0000', helpText: 'Lisage EE riigikood +372 telefoninumbri ette', }, { countryCode: 'PL', placeholder: '+48 000 000 000', helpText: 'Podaj numer kierunkowy PL +48 przed numerem telefonu', }, { countryCode: 'SK', placeholder: '+421 000 000 000', helpText: 'Pred telefónne číslo uveďte kód krajiny SK +421', }, { countryCode: 'LV', placeholder: '+371 0000 0000', helpText: 'Iekļaujiet LV valsts kodu +371 pirms tālruņa numura', }, { countryCode: 'LT', placeholder: '+370 0000 0000', helpText: 'Įtraukite LT šalies kodą +370 prieš telefono numerį', }, { countryCode: 'GR', placeholder: '+30 000 000 0000', helpText: 'Συμπεριλάβετε τον κωδικό χώρας GR +30 πριν από τον αριθμό τηλεφώνου', }, { countryCode: 'PT', placeholder: '+351 000 000 000', helpText: 'Inclua o código de país PT +351 antes do número de telefone', }, { countryCode: 'HR', placeholder: '+385 00 000 0000', helpText: 'Uključite HR pozivni broj države +385 prije telefonskog broja', }, { countryCode: 'SI', placeholder: '+386 00 000 000', helpText: 'Vključite SI kodo države +386 pred telefonsko številko', }, { countryCode: 'IS', placeholder: '+354 000 0000', helpText: 'Láttu IS landsnúmer +354 fylgja á undan símanúmerinu', }, { countryCode: 'LU', placeholder: '+352 000 000 000', helpText: 'Incluez le code pays LU +352 avant le numéro de téléphone', }, { countryCode: 'MC', placeholder: '+377 00 00 00 00', helpText: 'Incluez le code pays MC +377 avant le numéro de téléphone', }, { countryCode: 'AD', placeholder: '+376 000 000', helpText: 'Incloeu el codi de país AD +376 abans del número de telèfon', }, { countryCode: 'JE', placeholder: '+44 0000 000000', helpText: 'Include the JE country code +44 before the phone number', }, { countryCode: 'IM', placeholder: '+44 0000 000000', helpText: 'Include the IM country code +44 before the phone number', }, { countryCode: 'GG', placeholder: '+44 0000 000000', helpText: 'Include the GG country code +44 before the phone number', }, { countryCode: 'AL', placeholder: '+355 00 000 0000', helpText: 'Përfshini kodin e vendit AL +355 para numrit të telefonit', }, { countryCode: 'SM', placeholder: '+378 0000 000000', helpText: 'Includere il prefisso internazionale SM +378 prima del numero di telefono', }, { countryCode: 'FO', placeholder: '+298 000000', helpText: 'Inkluder FO landekode +298 før telefonnummeret', }, { countryCode: 'MT', placeholder: '+356 0000 0000', helpText: 'Include the MT country code +356 before the phone number', }, { countryCode: 'LI', placeholder: '+423 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die LI-Ländervorwahl +423 ein', }, { countryCode: 'GI', placeholder: '+350 000 00000', helpText: 'Include the GI country code +350 before the phone number', }, { countryCode: 'MD', placeholder: '+373 00 000 000', helpText: 'Includeți codul de țară MD +373 înaintea numărului de telefon', }, { countryCode: 'HU', placeholder: '+36 00 000 0000', helpText: 'A telefonszám előtt adja meg a HU országkódot +36', }, { countryCode: 'NZ', placeholder: '+64 00 000 0000', helpText: 'Include the NZ country code +64 before the phone number', }, { countryCode: 'ME', placeholder: '+382 00 000 000', helpText: 'Uključite ME pozivni broj države +382 prije telefonskog broja', }, ]; const selectedPlaceholder = mockPlaceholders.find(function(item) { return item && item.countryCode === countryCode; }); return selectedPlaceholder ? selectedPlaceholder.placeholder : mockPlaceholders[0].placeholder; } function updatePlaceholder(countryCode, fieldName) { if (!countryCode || !fieldName) { return; } const phoneInput = document.querySelector('#mce-' + fieldName); if (!phoneInput) { return; } const placeholder = getDefaultPlaceholder(countryCode); if (placeholder) { phoneInput.placeholder = placeholder; } } function updateCountryCodeInstruction(countryCode, fieldName) { updatePlaceholder(countryCode, fieldName); } function getDefaultHelpText(countryCode) { var mockPlaceholders = [ { countryCode: 'US', placeholder: '+1 000 000 0000', helpText: 'Include the US country code +1 before the phone number', }, { countryCode: 'GB', placeholder: '+44 0000 000000', helpText: 'Include the GB country code +44 before the phone number', }, { countryCode: 'CA', placeholder: '+1 000 000 0000', helpText: 'Include the CA country code +1 before the phone number', }, { countryCode: 'AU', placeholder: '+61 000 000 000', helpText: 'Include the AU country code +61 before the phone number', }, { countryCode: 'DE', placeholder: '+49 000 0000000', helpText: 'Fügen Sie vor der Telefonnummer die DE-Ländervorwahl +49 ein', }, { countryCode: 'FR', placeholder: '+33 0 00 00 00 00', helpText: 'Incluez le code pays FR +33 avant le numéro de téléphone', }, { countryCode: 'ES', placeholder: '+34 000 000 000', helpText: 'Incluya el código de país ES +34 antes del número de teléfono', }, { countryCode: 'NL', placeholder: '+31 0 00000000', helpText: 'Voeg de NL-landcode +31 toe vóór het telefoonnummer', }, { countryCode: 'BE', placeholder: '+32 000 00 00 00', helpText: 'Incluez le code pays BE +32 avant le numéro de téléphone', }, { countryCode: 'CH', placeholder: '+41 00 000 00 00', helpText: 'Fügen Sie vor der Telefonnummer die CH-Ländervorwahl +41 ein', }, { countryCode: 'AT', placeholder: '+43 000 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die AT-Ländervorwahl +43 ein', }, { countryCode: 'IE', placeholder: '+353 00 000 0000', helpText: 'Include the IE country code +353 before the phone number', }, { countryCode: 'IT', placeholder: '+39 000 000 0000', helpText: 'Includere il prefisso internazionale IT +39 prima del numero di telefono', }, { countryCode: 'NO', placeholder: '+47 000 00 000', helpText: 'Inkluder NO landskode +47 før telefonnummeret', }, { countryCode: 'SE', placeholder: '+46 00 000 00 00', helpText: 'Inkludera SE landskod +46 före telefonnumret', }, { countryCode: 'DK', placeholder: '+45 00 00 00 00', helpText: 'Inkluder DK landekode +45 før telefonnummeret', }, { countryCode: 'FI', placeholder: '+358 00 000 0000', helpText: 'Sisällytä FI-maakoodi +358 ennen puhelinnumeroa', }, { countryCode: 'EE', placeholder: '+372 0000 0000', helpText: 'Lisage EE riigikood +372 telefoninumbri ette', }, { countryCode: 'PL', placeholder: '+48 000 000 000', helpText: 'Podaj numer kierunkowy PL +48 przed numerem telefonu', }, { countryCode: 'SK', placeholder: '+421 000 000 000', helpText: 'Pred telefónne číslo uveďte kód krajiny SK +421', }, { countryCode: 'LV', placeholder: '+371 0000 0000', helpText: 'Iekļaujiet LV valsts kodu +371 pirms tālruņa numura', }, { countryCode: 'LT', placeholder: '+370 0000 0000', helpText: 'Įtraukite LT šalies kodą +370 prieš telefono numerį', }, { countryCode: 'GR', placeholder: '+30 000 000 0000', helpText: 'Συμπεριλάβετε τον κωδικό χώρας GR +30 πριν από τον αριθμό τηλεφώνου', }, { countryCode: 'PT', placeholder: '+351 000 000 000', helpText: 'Inclua o código de país PT +351 antes do número de telefone', }, { countryCode: 'HR', placeholder: '+385 00 000 0000', helpText: 'Uključite HR pozivni broj države +385 prije telefonskog broja', }, { countryCode: 'SI', placeholder: '+386 00 000 000', helpText: 'Vključite SI kodo države +386 pred telefonsko številko', }, { countryCode: 'IS', placeholder: '+354 000 0000', helpText: 'Láttu IS landsnúmer +354 fylgja á undan símanúmerinu', }, { countryCode: 'LU', placeholder: '+352 000 000 000', helpText: 'Incluez le code pays LU +352 avant le numéro de téléphone', }, { countryCode: 'MC', placeholder: '+377 00 00 00 00', helpText: 'Incluez le code pays MC +377 avant le numéro de téléphone', }, { countryCode: 'AD', placeholder: '+376 000 000', helpText: 'Incloeu el codi de país AD +376 abans del número de telèfon', }, { countryCode: 'JE', placeholder: '+44 0000 000000', helpText: 'Include the JE country code +44 before the phone number', }, { countryCode: 'IM', placeholder: '+44 0000 000000', helpText: 'Include the IM country code +44 before the phone number', }, { countryCode: 'GG', placeholder: '+44 0000 000000', helpText: 'Include the GG country code +44 before the phone number', }, { countryCode: 'AL', placeholder: '+355 00 000 0000', helpText: 'Përfshini kodin e vendit AL +355 para numrit të telefonit', }, { countryCode: 'SM', placeholder: '+378 0000 000000', helpText: 'Includere il prefisso internazionale SM +378 prima del numero di telefono', }, { countryCode: 'FO', placeholder: '+298 000000', helpText: 'Inkluder FO landekode +298 før telefonnummeret', }, { countryCode: 'MT', placeholder: '+356 0000 0000', helpText: 'Include the MT country code +356 before the phone number', }, { countryCode: 'LI', placeholder: '+423 000 0000', helpText: 'Fügen Sie vor der Telefonnummer die LI-Ländervorwahl +423 ein', }, { countryCode: 'GI', placeholder: '+350 000 00000', helpText: 'Include the GI country code +350 before the phone number', }, { countryCode: 'MD', placeholder: '+373 00 000 000', helpText: 'Includeți codul de țară MD +373 înaintea numărului de telefon', }, { countryCode: 'HU', placeholder: '+36 00 000 0000', helpText: 'A telefonszám előtt adja meg a HU országkódot +36', }, { countryCode: 'NZ', placeholder: '+64 00 000 0000', helpText: 'Include the NZ country code +64 before the phone number', }, { countryCode: 'ME', placeholder: '+382 00 000 000', helpText: 'Uključite ME pozivni broj države +382 prije telefonskog broja', }, ]; if (!countryCode || typeof countryCode !== 'string') { return mockPlaceholders[0].helpText; } const selectedHelpText = mockPlaceholders.find(function(item) { return item && item.countryCode === countryCode; }); return selectedHelpText ? selectedHelpText.helpText : mockPlaceholders[0].helpText; } function setDefaultHelpText(countryCode) { const helpTextSpan = document.querySelector('#help-text'); if (!helpTextSpan) { return; } } function updateHelpTextCountryCode(countryCode, fieldName) { if (!countryCode || !fieldName) { return; } setDefaultHelpText(countryCode); } function initializeSmsPhoneDropdown(fieldName) { if (!fieldName || typeof fieldName !== 'string') { return; } const dropdown = document.querySelector('#country-select-' + fieldName); const displayFlag = document.querySelector('#flag-display-' + fieldName); if (!dropdown || !displayFlag) { return; } const smsPhoneData = window.MC?.smsPhoneData; if (smsPhoneData && smsPhoneData.programs && Array.isArray(smsPhoneData.programs)) { dropdown.innerHTML = generateDropdownOptions(smsPhoneData.programs); } const defaultProgram = getDefaultCountryProgram(smsPhoneData?.defaultCountryCode, smsPhoneData?.programs); if (defaultProgram && defaultProgram.countryCode) { dropdown.value = defaultProgram.countryCode; const flagSpan = displayFlag?.querySelector('#flag-emoji-' + fieldName); if (flagSpan) { flagSpan.textContent = getCountryUnicodeFlag(defaultProgram.countryCode); flagSpan.setAttribute('aria-label', sanitizeHtml(defaultProgram.countryCode) + ' flag'); } updateSmsLegalText(defaultProgram.countryCode, fieldName); updatePlaceholder(defaultProgram.countryCode, fieldName); updateCountryCodeInstruction(defaultProgram.countryCode, fieldName); } var smsNotRequiredRemoveCountryCodeEnabled = true; var smsField = Object.values({"EMAIL":{"name":"EMAIL","label":"Email Address","helper_text":"","type":"email","required":true,"audience_field_name":"Email Address","merge_id":0,"help_text_enabled":false,"enabled":true,"order":0,"field_type":"merge"},"FNAME":{"name":"FNAME","label":"First Name","helper_text":"","type":"text","required":false,"audience_field_name":"First Name","enabled":false,"order":null,"field_type":"merge","merge_id":1},"MMERGE2":{"name":"MMERGE2","label":"Second Name","helper_text":"","type":"text","required":false,"audience_field_name":"Second Name","enabled":false,"order":null,"field_type":"merge","merge_id":2},"MMERGE3":{"name":"MMERGE3","label":"Company Name","helper_text":"","type":"text","required":false,"audience_field_name":"Company Name","enabled":false,"order":null,"field_type":"merge","merge_id":3},"MMERGE4":{"name":"MMERGE4","label":"Job Title","helper_text":"","type":"text","required":false,"audience_field_name":"Job Title","enabled":false,"order":null,"field_type":"merge","merge_id":4},"SIGNUP":{"name":"SIGNUP","label":"Signup form location","helper_text":"","type":"text","required":false,"audience_field_name":"Signup form location","enabled":false,"order":null,"field_type":"merge","merge_id":5},"MMERGE6":{"name":"MMERGE6","label":"Image URL","helper_text":"","type":"imageurl","required":false,"audience_field_name":"Image URL","enabled":false,"order":null,"field_type":"merge","merge_id":6}}).find(function(f) { return f.name === fieldName && f.type === 'smsphone'; }); var isRequired = smsField ? smsField.required : false; var shouldAppendCountryCode = smsNotRequiredRemoveCountryCodeEnabled ? isRequired : true; var phoneInput = document.querySelector('#mce-' + fieldName); if (phoneInput && defaultProgram.countryCallingCode && shouldAppendCountryCode) { phoneInput.value = defaultProgram.countryCallingCode; } displayFlag?.addEventListener('click', function(e) { dropdown.focus(); }); dropdown?.addEventListener('change', function() { const selectedCountry = this.value; if (!selectedCountry || typeof selectedCountry !== 'string') { return; } const flagSpan = displayFlag?.querySelector('#flag-emoji-' + fieldName); if (flagSpan) { flagSpan.textContent = getCountryUnicodeFlag(selectedCountry); flagSpan.setAttribute('aria-label', sanitizeHtml(selectedCountry) + ' flag'); } const selectedProgram = window.MC?.smsPhoneData?.programs.find(function(program) { return program && program.countryCode === selectedCountry; }); var smsNotRequiredRemoveCountryCodeEnabled = true; var smsField = Object.values({"EMAIL":{"name":"EMAIL","label":"Email Address","helper_text":"","type":"email","required":true,"audience_field_name":"Email Address","merge_id":0,"help_text_enabled":false,"enabled":true,"order":0,"field_type":"merge"},"FNAME":{"name":"FNAME","label":"First Name","helper_text":"","type":"text","required":false,"audience_field_name":"First Name","enabled":false,"order":null,"field_type":"merge","merge_id":1},"MMERGE2":{"name":"MMERGE2","label":"Second Name","helper_text":"","type":"text","required":false,"audience_field_name":"Second Name","enabled":false,"order":null,"field_type":"merge","merge_id":2},"MMERGE3":{"name":"MMERGE3","label":"Company Name","helper_text":"","type":"text","required":false,"audience_field_name":"Company Name","enabled":false,"order":null,"field_type":"merge","merge_id":3},"MMERGE4":{"name":"MMERGE4","label":"Job Title","helper_text":"","type":"text","required":false,"audience_field_name":"Job Title","enabled":false,"order":null,"field_type":"merge","merge_id":4},"SIGNUP":{"name":"SIGNUP","label":"Signup form location","helper_text":"","type":"text","required":false,"audience_field_name":"Signup form location","enabled":false,"order":null,"field_type":"merge","merge_id":5},"MMERGE6":{"name":"MMERGE6","label":"Image URL","helper_text":"","type":"imageurl","required":false,"audience_field_name":"Image URL","enabled":false,"order":null,"field_type":"merge","merge_id":6}}).find(function(f) { return f.name === fieldName && f.type === 'smsphone'; }); var isRequired = smsField ? smsField.required : false; var shouldAppendCountryCode = smsNotRequiredRemoveCountryCodeEnabled ? isRequired : true; var phoneInput = document.querySelector('#mce-' + fieldName); if (phoneInput && selectedProgram.countryCallingCode && shouldAppendCountryCode) { phoneInput.value = selectedProgram.countryCallingCode; } updateSmsLegalText(selectedCountry, fieldName); updatePlaceholder(selectedCountry, fieldName); updateCountryCodeInstruction(selectedCountry, fieldName); }); } document.addEventListener('DOMContentLoaded', function() { const smsPhoneFields = document.querySelectorAll('[id^="country-select-"]'); smsPhoneFields.forEach(function(dropdown) { const fieldName = dropdown?.id.replace('country-select-', ''); initializeSmsPhoneDropdown(fieldName); }); });

- Advertisment -

Most Popular