MalformedURLException on install referrer - no problems with Google Analytics

191 views
Skip to first unread message

Matt

unread,
Sep 15, 2011, 6:05:43 PM9/15/11
to Google AdMob Ads Developers
Hi there,

I've been trying to get the AdMob SDK up and running in one of our
Android applications in order to track install referrals. Although I'm
convinced I've followed instructions, documentation and other's hints
to the point, I'm puzzled why it still doesn't work. I hope you will
be able to help me out here.

I started off following the instruction as outlined here:
http://developer.admob.com/wiki/Android_App_Download_Tracking#Step_2:_Integrate_the_Google_AdMob_Ads_SDK_into_Your_App

Then I published the app on the market (I know, later on I found an
app to simulate install referrals...)

Next step was to generate a market URL as described here:
http://code.google.com/mobile/analytics/docs/android/#android-market-tracking

The resulting URL is in my case imply:
http://market.android.com/details?id=<app_name>&referrer=utm_source%3Dtestcampaign%26utm_medium%3Dtestmedium%26utm_term%3Dtestterm%26utm_content%3Dtestcampaigncontent%26utm_campaign%3Dtestcampaignname
(Where <app_name> obviously is the app's name)

So far so good. Upon installing on a device (from the market) the
install referral seems to be coming through. However, in Logcat I see
the following error:

09-15 23:19:51.468: ERROR/Ads(15057): Unhandled exception processing
Market install.
09-15 23:19:51.468: ERROR/Ads(15057): java.net.MalformedURLException
09-15 23:19:51.468: ERROR/Ads(15057): at
java.net.URL.<init>(URL.java:211)
09-15 23:19:51.468: ERROR/Ads(15057): at
java.net.URL.<init>(URL.java:159)
09-15 23:19:51.468: ERROR/Ads(15057): at
com.google.ads.InstallReceiver.onReceive(Unknown Source)
09-15 23:19:51.468: ERROR/Ads(15057): at
android.app.ActivityThread.handleReceiver(ActivityThread.java:2900)
09-15 23:19:51.468: ERROR/Ads(15057): at
android.app.ActivityThread.access$3400(ActivityThread.java:129)
09-15 23:19:51.468: ERROR/Ads(15057): at android.app.ActivityThread
$H.handleMessage(ActivityThread.java:2167)
09-15 23:19:51.468: ERROR/Ads(15057): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-15 23:19:51.468: ERROR/Ads(15057): at
android.os.Looper.loop(Looper.java:143)
09-15 23:19:51.468: ERROR/Ads(15057): at
android.app.ActivityThread.main(ActivityThread.java:4717)
09-15 23:19:51.468: ERROR/Ads(15057): at
java.lang.reflect.Method.invokeNative(Native Method)
09-15 23:19:51.468: ERROR/Ads(15057): at
java.lang.reflect.Method.invoke(Method.java:521)
09-15 23:19:51.468: ERROR/Ads(15057): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-15 23:19:51.468: ERROR/Ads(15057): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-15 23:19:51.468: ERROR/Ads(15057): at
dalvik.system.NativeStart.main(Native Method)

Unfortunately there seems to be little to none documentation on this
error nor others encountering the same problem. It seems like AbMob is
trying to parse a string into a URL, which is not formatted as a URL.

I tried to figure out what was coming through, so initially I changed
the manifest to pass the referral on to a custom broadcast receiver by
adding it to the meta-data:

<receiver android:name="com.google.ads.InstallReceiver"
android:exported="true">
<intent-filter>
<action
android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
<meta-data android:name="forward.BRT"

android:value="<app_name>.BRTReferralBroadcastReceiver" />
</receiver>

However, as I see none of the log statements in my
BRTReferralBroadcastReceiver, it appears that the referral is consumed
because an exception is thrown.

So I ended up directly passing the referral to my own broadcast
receiver, and from there pass it on to AdMob. I also added a direct
pass-through to Google Analytics, just to see what that tells me. I am
aware of the fact that AdMob also does this though. The code is as
follows:

public class BRTReferralBroadcastReceiver extends BroadcastReceiver {

private static final String BRT = "BRT";

@Override
public void onReceive(Context context, Intent intent) {
Log.d(BRT,"Referral received!");
Bundle extras = intent.getExtras();

Set<String> keySet = extras.keySet();
for (String key : keySet)
Log.d(BRT, "Key: " + key + " - " + extras.get(key));
Log.d(BRT,"Passing referral to Analytics...");
new
com.google.android.apps.analytics.AnalyticsReceiver().onReceive(context,
intent);

Log.d(BRT,"Passing referral to AdMob...");
new com.google.ads.InstallReceiver().onReceive(context,
intent);
}
}

Logcat shows me the following:

09-15 23:48:18.116: DEBUG/BRT(15964): Referral received!
09-15 23:48:18.124: DEBUG/BRT(15964): Key: referrer -
utm_source=testcampaign&utm_medium=testmedium&utm_term=testterm&utm_content=testcampaigncontent&utm_campaign=testcampaignname
09-15 23:48:18.124: DEBUG/BRT(15964): Passing referral to Analytics...
09-15 23:48:18.124: INFO/GoogleAnalyticsTracker(15964):
referrer=utm_source=testcampaign&utm_medium=testmedium&utm_term=testterm&utm_content=testcampaigncontent&utm_campaign=testcampaignname
09-15 23:48:18.265: DEBUG/GoogleAnalyticsTracker(15964): Referrer
store attemped succeeded.
09-15 23:48:18.272: DEBUG/BRT(15964): Passing referral to AdMob...
09-15 23:48:18.311: ERROR/Ads(15964): Unhandled exception processing
Market install.
09-15 23:48:18.311: ERROR/Ads(15964): java.net.MalformedURLException
09-15 23:48:18.311: ERROR/Ads(15964): at
java.net.URL.<init>(URL.java:211)
09-15 23:48:18.311: ERROR/Ads(15964): at
java.net.URL.<init>(URL.java:159)
09-15 23:48:18.311: ERROR/Ads(15964): at
com.google.ads.InstallReceiver.onReceive(Unknown Source)
09-15 23:48:18.311: ERROR/Ads(15964): at
nz.co.juliusspencer.android.broadcastreceivertest.BRTReferralBroadcastReceiver.onReceive(BRTReferralBroadcastReceiver.java:
38)
09-15 23:48:18.311: ERROR/Ads(15964): at
android.app.ActivityThread.handleReceiver(ActivityThread.java:2900)
09-15 23:48:18.311: ERROR/Ads(15964): at
android.app.ActivityThread.access$3400(ActivityThread.java:129)
09-15 23:48:18.311: ERROR/Ads(15964): at android.app.ActivityThread
$H.handleMessage(ActivityThread.java:2167)
09-15 23:48:18.311: ERROR/Ads(15964): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-15 23:48:18.311: ERROR/Ads(15964): at
android.os.Looper.loop(Looper.java:143)
09-15 23:48:18.311: ERROR/Ads(15964): at
android.app.ActivityThread.main(ActivityThread.java:4717)
09-15 23:48:18.311: ERROR/Ads(15964): at
java.lang.reflect.Method.invokeNative(Native Method)
09-15 23:48:18.311: ERROR/Ads(15964): at
java.lang.reflect.Method.invoke(Method.java:521)
09-15 23:48:18.311: ERROR/Ads(15964): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-15 23:48:18.311: ERROR/Ads(15964): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-15 23:48:18.311: ERROR/Ads(15964): at
dalvik.system.NativeStart.main(Native Method)

In other words: the referral gets received and the referral string is
identical to what I generated earlier. That's also all the data that
appears to be received. The Google Analytics tracker seems to
recognize the referral string and says it has been successfully
stored. However, the MalformedURLException is again being thrown by
AdMob. It's almost as if it tries to parse the referral string into a
URL, which doesn't really make sense...

Currently I've tried:
-AdMob SDK version 4.0.4 and 4.1.1 (latest).
-Different phones, including a Google Nexus One, Motorola Defy MB525
and Samsung Galaxy Spica GT-I5700.
-Rebuilding the URL to have it contain "market://details?
id=<app_name>&" and then pass it on to AdMob - no luck.

I'm really hoping for someone to point me in the right direction.
Thanks!

Cheers,
Matt

Eric Leichtenschlag

unread,
Sep 15, 2011, 6:24:06 PM9/15/11
to google-adm...@googlegroups.com
App conversion tracking for Android is not yet publicly available.  This feature is being debugged and tested, but there is no official launch date at this time.

Best,
Eric

Matt

unread,
Sep 15, 2011, 9:26:24 PM9/15/11
to Google AdMob Ads Developers
Eric, thanks for the clarification. I have to admit I'm kind of
surprised though. If download tracking for Android isn't publicly
available yet, then how come there's a whole wiki page dedicated to
setting it up? I can hardly believe I'm the only one to have tried
this - you'll be surprised how little relevant results you get when
doing a Google search on the MalformedURLException in combination with
AdMob.

I guess for now I'll just stick with Analytics only.

Cheers,
Matt

On Sep 16, 10:24 am, Eric Leichtenschlag <eleichtens...@google.com>
wrote:

Eric Leichtenschlag

unread,
Sep 15, 2011, 9:37:55 PM9/15/11
to google-adm...@googlegroups.com
You aren't the only one, there have been a couple of other threads related to Android App Tracking recently.  That wiki page says it's only available for "managed accounts" right now, which explains why it won't work for you.  I'm not sure of the reasoning behind that wiki page being public though, it certainly has caused confusion.

Eric, AdMob SDK Support
Reply all
Reply to author
Forward
0 new messages