93 Paid Clicks, Zero Signups: My Google Button Doesn't Work Inside TikTok
Originally published on meridianbuild.dev , my build log for
What the TikTok visitors had in common
</h2> <p>The ad audience was not perfect. The age targeting didn't hold: 63 % of the visitors were 18 to 24, which is my weakest age group for payments. But that age group signs up fine. It just doesn't pay. Age could explain zero sales. It could not explain zero accounts.</p> <p>The thing every one of those 93 people shared was the browser. When you tap a link in a TikTok ad, the page doesn't open in Safari or Chrome. It opens inside TikTok, in an embedded webview. Instagram and Facebook do the same.</p> <p>And the first button on my sign-up page was "Continue with Google".</p> <h2>Google says no to webviews
</h2> <p>Google's sign-in refuses to run inside embedded webviews. If you start a Google OAuth flow from one, you don't get the account picker. You get an error page: <code>Error 403: disallowed_useragent</code>. Google's reason is security: an app that hosts a webview can see everything typed into it, including a password.</p> <p>So from inside TikTok, my funnel was:</p> <ol> <li>See the ad, tap it.</li> <li>Land on a page whose biggest button is Google.</li> <li>Tap it, get a Google error page in English talking about user agents.</li> <li>Leave.</li> </ol> <p>The email form was right below the button, and it works fine in a webview. But a person who just hit an error page doesn't scroll down to try plan B. They close the page and go back to their feed.</p> <p>I can't prove that this was the cause for all 93 visits. I didn't have tracking on in-app sign-up views at the time, which is exactly the problem I fixed next. But it's the one thing that was different for those visitors, it was the first thing they'd tap, and it fails 100 % of the time in that browser. I shipped the fix the same day.</p> <h2>Detecting the in-app browser
</h2> <p>There's no API for "am I in a webview". The only signal is the User-Agent, and each app adds its own token. Here is the module, more or less as it is in production:<br> </p> <div class="highlight js-code-highlight"> <pre class="highlight ruby"><code><span class="k">module</span> <span class="nn">InAppBrowser</span> <span class="no">RULES</span> <span class="o">=</span> <span class="p">[</span> <span class="p">[</span><span class="ss">:tiktok</span><span class="p">,</span> <span class="sr">/musical_ly|BytedanceWebview|TikTok/</span><span class="p">],</span> <span class="p">[</span><span class="ss">:instagram</span><span class="p">,</span> <span class="sr">/Instagram/</span><span class="p">],</span> <span class="p">[</span><span class="ss">:facebook</span><span class="p">,</span> <span class="sr">/FBAN|FBAV|FB_IAB/</span><span class="p">],</span> <span class="p">[</span><span class="ss">:snapchat</span><span class="p">,</span> <span class="sr">/Snapchat/</span><span class="p">],</span> <span class="p">[</span><span class="ss">:linkedin</span><span class="p">,</span> <span class="sr">/LinkedInApp/</span><span class="p">],</span> <span class="p">[</span><span class="ss">:other_webview</span><span class="p">,</span> <span class="sr">/; wv\)/</span><span class="p">]</span> <span class="p">].</span><span class="nf">freeze</span><span class="kp">module_function</span>
<span class="k">def</span> <span class="nf">detect</span><span class="p">(</span><span class="n">user_agent</span><span class="p">)</span> <span class="k">return</span> <span class="kp">nil</span> <span class="k">if</span> <span class="n">user_agent</span><span class="p">.</span><span class="nf">blank?</span>
text<span class="no">RULES</span><span class="p">.</span><span class="nf">each</span> <span class="p">{</span> <span class="o">|</span><span class="n">app</span><span class="p">,</span> <span class="n">pattern</span><span class="o">|</span> <span class="k">return</span> <span class="n">app</span> <span class="k">if</span> <span class="n">pattern</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="n">user_agent</span><span class="p">)</span> <span class="p">}</span> <span class="kp">nil</span>
<span class="k">end</span> <span class="k">end</span> </code></pre>
</div> <p>The order matters. On Android, the Instagram and Facebook User-Agents also contain <code>; wv)</code>, the generic Android WebView marker. If the generic rule came first, every Instagram visitor would be labelled "other webview". It goes last as a catch-all.</p> <p>User-Agent sniffing is fragile, and I know it. Apps change their strings. But the failure mode here is gentle. If detection misses a webview, the visitor sees the old page, which is what everyone saw before. If it wrongly flags a real browser, that visitor loses the Google button but still has a working email form. Neither mistake locks anyone out.</p> <h2>What the page does now
</h2> <p>A concern exposes the result to the Devise sign-up and sign-in views:<br> </p> <div class="highlight js-code-highlight"> <pre class="highlight ruby"><code><span class="k">module</span> <span class="nn">InAppBrowserDetection</span> <span class="kp">extend</span> <span class="no">ActiveSupport</span><span class="o">::</span><span class="no">Concern</span><span class="n">included</span> <span class="k">do</span> <span class="n">helper_method</span> <span class="ss">:in_app_browser</span><span class="p">,</span> <span class="ss">:in_app_android?</span> <span class="k">end</span>
<span class="kp">private</span>
<span class="k">def</span> <span class="nf">in_app_browser</span> <span class="k">return</span> <span class="vi">@in_app_browser</span> <span class="k">if</span> <span class="k">defined?</span><span class="p">(</span><span class="vi">@in_app_browser</span><span class="p">)</span>
text<span class="vi">@in_app_browser</span> <span class="o">=</span> <span class="no">InAppBrowser</span><span class="p">.</span><span class="nf">detect</span><span class="p">(</span><span class="n">request</span><span class="p">.</span><span class="nf">user_agent</span><span class="p">)</span>
<span class="k">end</span> <span class="k">end</span> </code></pre>
</div> <p>Inside TikTok, Instagram or Facebook, the page changes in three ways:</p> <ul> <li> <strong>Google is hidden.</strong> A button that can only produce an error page is worse than no button.</li> <li> <strong>Email goes first.</strong> The form that works is the first thing you see.</li> <li> <strong>A short tip explains how to get Google back</strong>: open the page in your real browser. On Android, there's a one-tap link that uses a Chrome intent URL (<code>intent://...;package=com.android.chrome;end</code>) to reopen the same page in Chrome. iOS has no reliable equivalent, so iOS visitors only get the text.</li> </ul> <p>The tip can be dismissed, and the dismissal is remembered, so it doesn't nag.</p> <h2>Measuring it this time
</h2> <p>The other half of the fix is that I can now see this funnel. Each sign-up page view inside a webview fires an <code>in_app_signup_view</code> event with the app name. Each signup made inside a webview carries an <code>in_app</code> property on the existing <code>Signup</code> event. Those two numbers give me a conversion rate for each app, which is what I was missing on October 30. I only had a total of zero.</p> <p>That's the lesson I'd keep even without the webview part: <strong>when you pay for traffic, check that the page works in the browser that traffic actually uses.</strong> I tested my sign-up page in Chrome, Safari and Firefox, on desktop and on a phone. I never opened it from inside the app that I was paying to send people from.</p> <h2>Takeaways
</h2> <ul> <li>If your traffic comes from TikTok, Instagram or Facebook, your page opens in their webview. Test it there, by tapping your own link inside the app.</li> <li>Google OAuth doesn't work in those webviews. If Google is your first or only sign-in option, those visitors hit an error page.</li> <li>Detect the webview from the User-Agent, put the generic Android <code>; wv)</code> rule last, and make sure a wrong guess fails gently.</li> <li>Measure the in-app funnel separately. A blended conversion rate of 19.8 % hid a channel that was converting at zero.</li> </ul> <p>21 € is cheap tuition. The expensive version of this story is the one where you scale the ad first.</p>Original source
Tags
Related Articles
Continue reading with these similar posts

Elon Musk Is Portrayed on ‘SNL’: “The Worst Thing South Africa Has Ever Done”
Jeremy Culhane plays the character in the show’s latest attempt to assess its relationship with the mogul.

King Charles Was Umbrella-Less but in His Element on Caribbean Tour
In his twilight years, the British monarch is embracing his role as a global statesman, even when that involves heavy rain and difficult questions about his nation’s history.

Cathie Wood 'always feels better when the market is worried' — here's why
The Ark Invest CEO said there was a "wall of worry" gripping markets right now.

IP Companies Spin Books Into Sold-Out Plays, Series and Signature Scents at Taiwan Creative Content Fest
Taiwanese companies laid out how original stories can grow from books into stage plays, series, fragrances and even travel itineraries at a Taiwan Creative Content Fest (TCCF) session on cross-sector

TeamGroup GA Pro 2TB SSD Review: A faltering attempt at a mid-range PCIe 5.0 SSD
Every once in a while we get a drive that comes across our desk that stands out, for good or for

vivo X500 Ultra on track to launch next year, says tipster
Read vivo X500 Ultra on track to launch next year, says tipster and explore its linked sources.