Mobile Apps
Stay organized with collections
Save and categorize content based on your preferences.
Create a mobile app extension
function
createMobileApp
()
{
//
For
full
details
on
creating
a
new
mobile
app
extension
,
see
:
//
https
:
//
developers
.
google
.
com
/
google
-
ads
/
scripts
/
docs
/
reference
/
adsapp
/
adsapp_mobileappbuilder
const
newMobileApp
=
AdsApp
.
extensions
()
.
newMobileAppBuilder
()
//
See
https
:
//
support
.
google
.
com
/
google
-
ads
/
answer
/
2402582
for
details
//
on
how
to
obtain
applications
specific
store
id
.
withAppId
(
'INSERT_STORE_SPECIFIC_APP_ID_HERE'
)
//
required
//
For
iOS
apps
,
use
'iOS'
here
.
withStore
(
'Android'
)
//
required
//
Replace
the
values
below
with
your
link
text
,
final
url
,
and
start
date
.
withLinkText
(
'Download App Here'
)
//
required
.
withFinalUrl
(
'http://www.example.com/androidApp'
)
//
required
.
withStartDate
({
day
:
29
,
month
:
2
,
year
:
2024
})
//
optional
.
build
()
.
getResult
();
//
Add
mobile
app
to
a
campaign
const
campaignIterator
=
AdsApp
.
campaigns
()
.
withCondition
(
'campaign.name = "INSERT_CAMPAIGN_NAME_HERE"'
)
.
get
();
if
(
campaignIterator
.
hasNext
())
{
const
campaign
=
campaignIterator
.
next
();
campaign
.
addMobileApp
(
newMobileApp
);
}
//
Add
mobile
app
to
an
ad
group
const
adGroupIterator
=
AdsApp
.
adGroups
()
.
withCondition
(
'campaign.name = "INSERT_CAMPAIGN_NAME_HERE"'
)
.
withCondition
(
'ad_group.name = "INSERT_AD_GROUP_NAME_HERE"'
)
.
get
();
if
(
adGroupIterator
.
hasNext
())
{
const
adGroup
=
adGroupIterator
.
next
();
adGroup
.
addMobileApp
(
newMobileApp
);
}
//
Add
mobile
app
to
an
account
const
account
=
AdsApp
.
currentAccount
();
account
.
addMobileApp
(
newMobileApp
);
}
Log mobile app extensions details for a campaign
function
logMobileAppDetails
()
{
//
Get
a
campaign
.
const
campaignIterator
=
AdsApp
.
campaigns
()
.
withCondition
(
'campaign.name = "INSERT_CAMPAIGN_NAME_HERE"'
)
.
get
();
if
(
!
campaignIterator
.
hasNext
())
{
throw
new
Error
(
'Campaign not found.'
);
}
const
campaign
=
campaignIterator
.
next
();
//
Retrieve
the
campaign
's mobile apps. Retrieving an ad group'
s
and
//
account
's mobile apps is similar.
const
mobileAppIterator
=
campaign
.
extensions
()
.
mobileApps
()
.
get
();
for
(
const
mobileApp
of
mobileAppIterator
)
{
//
You
can
also
request
reports
for
pre
-
defined
date
ranges
.
See
//
https
:
//
developers
.
google
.
com
/
adwords
/
api
/
docs
/
guides
/
awql
,
//
DateRangeLiteral
section
for
possible
values
.
const
stats
=
mobileApp
.
getStatsFor
(
'LAST_MONTH'
);
console
.
log
(
`
Mobile
app
id
:
$
{
mobileApp
.
getAppId
()
}
`
);
console
.
log
(
`
link
text
:
$
{
mobileApp
.
getLinkText
()
}
`
);
console
.
log
(
`
final
URL
:
$
{
mobileApp
.
urls
()
.
getFinalUrl
()
}
`
);
console
.
log
(
`
clicks
:
$
{
stats
.
getClicks
()
}
`
);
console
.
log
(
`
impressions
:
$
{
stats
.
getImpressions
()
}
`
);
console
.
log
(
'======='
);
}
console
.
log
(
`
$
{
mobileAppIterator
.
totalNumEntities
()}
mobile
apps
in
the
campaign
`
);
}
Set schedule for mobile apps in a campaign
function
setMobileAppSchedule
()
{
//
Get
a
campaign
.
const
campaignIterator
=
AdsApp
.
campaigns
()
.
withCondition
(
'campaign.name = "INSERT_CAMPAIGN_NAME_HERE"'
)
.
get
();
if
(
!
campaignIterator
.
hasNext
())
{
throw
new
Error
(
'Campaign not found.'
);
}
const
campaign
=
campaignIterator
.
next
();
//
Retrieve
the
campaign
's mobile apps. Retrieving an ad group'
s
and
//
account
's mobile apps is similar.
const
mobileAppIterator
=
campaign
.
extensions
()
.
mobileApps
()
.
get
();
for
(
const
mobileApp
of
mobileAppIterator
)
{
if
(
mobileApp
.
getAppId
()
===
'INSERT_STORE_SPECIFIC_APP_ID_HERE'
)
{
//
Set
mobile
app
schedule
to
run
only
on
Mondays
and
Tuesdays
,
9
AM
to
//
6
PM
.
const
monday
=
{
dayOfWeek
:
'MONDAY'
,
startHour
:
9
,
startMinute
:
0
,
endHour
:
18
,
endMinute
:
0
};
const
tuesday
=
{
dayOfWeek
:
'TUESDAY'
,
startHour
:
9
,
startMinute
:
0
,
endHour
:
18
,
endMinute
:
0
};
mobileApp
.
setSchedules
([
monday
,
tuesday
]);
break
;
}
}
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[[["\u003cp\u003eThis script demonstrates how to create and manage mobile app extensions in Google Ads, including adding them to campaigns, ad groups, and accounts.\u003c/p\u003e\n"],["\u003cp\u003eIt provides functionality to retrieve and log details of existing mobile app extensions, such as app ID, link text, and performance statistics.\u003c/p\u003e\n"],["\u003cp\u003eThe script also shows how to set custom schedules for mobile app extensions, controlling when they are eligible to appear.\u003c/p\u003e\n"]]],[],null,["# Mobile Apps\n\nCreate a mobile app extension\n-----------------------------\n\n```gdscript\nfunction createMobileApp() {\n // For full details on creating a new mobile app extension, see:\n // https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_mobileappbuilder\n const newMobileApp = AdsApp.extensions().newMobileAppBuilder()\n // See https://support.google.com/google-ads/answer/2402582 for details\n // on how to obtain applications specific store id\n .withAppId('INSERT_STORE_SPECIFIC_APP_ID_HERE') // required\n // For iOS apps, use 'iOS' here\n .withStore('Android') // required\n // Replace the values below with your link text, final url, and start date\n .withLinkText('Download App Here') // required\n .withFinalUrl('http://www.example.com/androidApp') // required\n .withStartDate({day : 29, month : 2, year : 2024}) // optional\n .build()\n .getResult();\n\n // Add mobile app to a campaign\n const campaignIterator = AdsApp.campaigns()\n .withCondition('campaign.name = \"INSERT_CAMPAIGN_NAME_HERE\"')\n .get();\n if (campaignIterator.hasNext()) {\n const campaign = campaignIterator.next();\n campaign.addMobileApp(newMobileApp);\n }\n\n // Add mobile app to an ad group\n const adGroupIterator = AdsApp.adGroups()\n .withCondition('campaign.name = \"INSERT_CAMPAIGN_NAME_HERE\"')\n .withCondition('ad_group.name = \"INSERT_AD_GROUP_NAME_HERE\"')\n .get();\n if (adGroupIterator.hasNext()) {\n const adGroup = adGroupIterator.next();\n adGroup.addMobileApp(newMobileApp);\n }\n\n // Add mobile app to an account\n const account = AdsApp.currentAccount();\n account.addMobileApp(newMobileApp);\n}\n```\n\nLog mobile app extensions details for a campaign\n------------------------------------------------\n\n```gdscript\nfunction logMobileAppDetails() {\n // Get a campaign.\n const campaignIterator = AdsApp.campaigns()\n .withCondition('campaign.name = \"INSERT_CAMPAIGN_NAME_HERE\"')\n .get();\n if (!campaignIterator.hasNext()) {\n throw new Error('Campaign not found.');\n }\n const campaign = campaignIterator.next();\n\n // Retrieve the campaign's mobile apps. Retrieving an ad group's and\n // account's mobile apps is similar.\n const mobileAppIterator = campaign.extensions().mobileApps().get();\n\n for (const mobileApp of mobileAppIterator) {\n // You can also request reports for pre-defined date ranges. See\n // https://developers.google.com/adwords/api/docs/guides/awql,\n // DateRangeLiteral section for possible values.\n const stats = mobileApp.getStatsFor('LAST_MONTH');\n\n console.log(`Mobile app id : ${ mobileApp.getAppId() }`);\n console.log(`link text : ${ mobileApp.getLinkText() }`);\n console.log(`final URL : ${ mobileApp.urls().getFinalUrl() }`);\n console.log(`clicks : ${ stats.getClicks() }`);\n console.log(`impressions : ${ stats.getImpressions() }`);\n console.log('=======');\n }\n\n console.log(`${mobileAppIterator.totalNumEntities()} mobile apps in the campaign`);\n}\n```\n\nSet schedule for mobile apps in a campaign\n------------------------------------------\n\n```gdscript\nfunction setMobileAppSchedule() {\n // Get a campaign.\n const campaignIterator = AdsApp.campaigns()\n .withCondition('campaign.name = \"INSERT_CAMPAIGN_NAME_HERE\"')\n .get();\n if (!campaignIterator.hasNext()) {\n throw new Error('Campaign not found.');\n }\n const campaign = campaignIterator.next();\n\n // Retrieve the campaign's mobile apps. Retrieving an ad group's and\n // account's mobile apps is similar.\n const mobileAppIterator = campaign.extensions().mobileApps().get();\n\n for (const mobileApp of mobileAppIterator) {\n if (mobileApp.getAppId() === 'INSERT_STORE_SPECIFIC_APP_ID_HERE') {\n // Set mobile app schedule to run only on Mondays and Tuesdays, 9 AM to\n // 6 PM.\n const monday = {\n dayOfWeek: 'MONDAY',\n startHour: 9,\n startMinute: 0,\n endHour: 18,\n endMinute: 0\n };\n\n const tuesday = {\n dayOfWeek: 'TUESDAY',\n startHour: 9,\n startMinute: 0,\n endHour: 18,\n endMinute: 0\n };\n\n mobileApp.setSchedules([monday, tuesday]);\n\n break;\n }\n }\n}\n```"]]