Installation
copilot plugin marketplace add samueltauil/skills-hub
copilot plugin install google-mobile-ads-validate@skills-hub
Works with GitHub Copilot CLI and VS Code (enable chat.plugins.enabled).
Plugin google-mobile-ads-validate v1.0.0 follows the Agent Plugins spec.
gh skills-hub install google-mobile-ads-validate Don't have the extension? Run gh extension install samueltauil/skills-hub first.
Download and extract to your repository:
.github/skills/google-mobile-ads-validate/ Extract the ZIP to .github/skills/ in your repo. The folder name must match google-mobile-ads-validate for Copilot to auto-discover it.
Skill Files (6)
SKILL.md 2.4 KB
---
name: google-mobile-ads-validate
description: >-
Validates a project's Google Mobile Ads (GMA) SDK integration for iOS,
Android, or Unity projects. Use when conducting a full pre-launch audit of an
app that integrates GMA SDK or when validating any individual GMA SDK
integration checks, such as when validating ad unit IDs and ad formats,
SKAdNetwork IDs, mediation adapter SDK version compatibility, or ad
preloading.
metadata:
version: "1.1.1"
category: GoogleAds
---
# Validate Google Mobile Ads SDK Integration
Validate a project's Google Mobile Ads (GMA) SDK integration either as a
complete audit or for specific requested checks.
- **Full Audit**: If the user requests a general validation or full audit,
evaluate all checklist items.
- **Specific Checks**: If the user asks to validate only a specific area
(e.g., ad preloading), evaluate only the relevant check(s) without running
the entire checklist.
## Scoring Rules
For each check, apply one of the following statuses:
- **Pass**: None of the Warning, Fail, or N/A criteria are met.
- **Warning**, **Fail**, or **N/A**: The conditions described under each
respective status are met.
## Validation Checklist
Read the reference guide for each check to be performed:
- No test application ID is in the project, format correct:
`references/application-id.md`
- No test ad units are in the project, format correct:
`references/ad-units.md`
- Implemented all Google SKAdNetwork IDs:
`references/google-skadnetwork-ids.md`
- Mediation adapter compatibility:
`references/mediation-adapter-compatibility.md`
- Ad preloading validation checks: `references/ad-preloading.md`
## Final Output
Generate a Markdown report following the format below. **ONLY** include the
findings for items that were actually checked.
| Check | Status | Findings | Next Steps |
| :--- | :---: | :--- | :--- |
| No test application ID is in the project, format correct | {{status_1}} | {{findings_1}} | {{next_steps_1}} |
| No test ad units are in the project, format correct | {{status_2}} | {{findings_2}} | {{next_steps_2}} |
| Implemented all Google SKAdNetwork IDs | {{status_3}} | {{findings_3}} | {{next_steps_3}} |
| Mediation adapter compatibility | {{status_4}} | {{findings_4}} | {{next_steps_4}} |
| Ad preloading validation checks | {{status_5}} | {{findings_5}} | {{next_steps_5}} |
ad-preloading.md 1.9 KB
# Ad preloading validation checks
- **Follow These Steps**:
- [ ] Search for GMA SDK ad preloading calls for the respective platform:
| API | Android | iOS | Unity |
| :--- | :--- | :--- | :--- |
| Start Preload | `startPreload` | `preload` | `Preload` |
| Stop Preload | `destroyAll` | `stopPreloadingAndRemoveAllAds` | `DestroyAll` |
| Poll Ad | `pollAd` | `ad(with:)` | `DequeueAd` |
| Peek Ad | `peekAdResponseInfo` | `responseInfo(with:)` | `PeekAdResponseInfo` |
| Ad Preloaded | `onAdPreloaded` | `adAvailable(forPreloadID:)` | `OnAdPreloaded` |
| Ad Failed to Preload | `onAdFailedToPreload` | `adFailedToPreload(forPreloadID:error:)` | `OnAdFailedToPreload` |
| Ads Exhausted | `onAdsExhausted` | `adsExhausted(forPreloadID:)` | `OnAdsExhausted` |
| Ad Available Check | `isAdAvailable` | `isAdAvailable(with:)` | `IsAdAvailable` |
- **Pass/Fail Criteria**:
- **Fail**: Any of the following improper ad preloading patterns are
detected in the project:
- Polls an ad without showing it within the same method scope.
- Polls an ad to inspect its response info.
- Polls an ad unconditionally inside the ad preloaded callback.
- Starts or stops preloading in the ad preloaded, ad failed to
preload, or ads exhausted callback.
- Starts preloading for the same preload ID multiple times without
stopping the preloader first.
- Uses an empty string or null as the preload ID.
- Checks ad availability inside an `Update` loop on **Unity**.
- **Warning**:
- Polls an ad conditionally inside the ad preloaded callback. Notify
the user that polling an ad triggers another ad load.
- Preloads multiple ad unit IDs for the same ad format.
- Uses a buffer size greater than 5.
- **N/A**: The project doesn't use the ad preloading APIs.
ad-units.md 0.8 KB
# No test ad units are in the project, format correct
- **Follow These Steps**:
- [ ] Search the codebase for test ad unit IDs:
- **AdMob**: Any ad unit ID starting with
`ca-app-pub-3940256099942544/`.
- **Ad Manager**: Any ad unit ID starting with `/6499/` or
`/21775744923/`.
- **Pass/Fail Criteria**:
- **Fail**:
- Any ad unit ID is malformed:
- **AdMob**: Does not match regex
`^(ca-app-pub-[a-zA-Z0-9\-]+)/([a-zA-Z0-9_\-]+)(/.*)?$`.
- **Ad Manager**: Does not match regex
`^/[0-9]*/.*|^/[0-9]*,[0-9]*/.*`.
- **Warning**:
- Any test ad unit ID is found in source files, even if gated behind a
`DEBUG` flag. application-id.md 1.1 KB
# No test application ID is in the project, format correct
- **Follow These Steps**:
- [ ] Search the codebase for the application ID key names:
| Platform | Key Name |
| :--- | :--- |
| **Android** | `applicationId` in `InitializationConfig.Builder` |
| **iOS** | `GADApplicationIdentifier` key in Info.plist |
| **Unity** | `adMobAndroidAppId` / `adMobIOSAppId` in Unity editor settings |
- [ ] If multiple app IDs are found, evaluate each app ID individually.
- [ ] Check if any app ID uses an official Google test application ID:
- **AdMob**: `ca-app-pub-3940256099942544~1458002511`
- **Ad Manager**: `ca-app-pub-9939518381636264~1458516390`
- **Pass/Fail Criteria**:
- **Fail**:
- Any app ID does not match regex
`^(ca-app-pub-[a-zA-Z0-9\-]+)~(.*)$`.
- No app ID is found in the project.
- Multiple app IDs are configured for the same platform or build
target without flavor or environment separation.
- **Warning**:
- Any app ID found is an official Google test application ID. google-skadnetwork-ids.md 5.8 KB
# Implemented all Google SKAdNetwork IDs
- **Follow These Steps**:
- [ ] Determine if the project is Android, iOS, or Unity.
- [ ] If Android or Unity targeting Android only, mark as **N/A**.
- [ ] If iOS, inspect the `SKAdNetworkItems` array in `Info.plist`.
- [ ] If Unity targeting iOS, inspect
`GoogleMobileAdsSKAdNetworkItems.xml`.
- [ ] Run the Google SKAdNetwork IDs validator script below to verify that
all Google SKAdNetwork IDs are present. If a Python runtime or terminal
tool is unavailable, cross-reference the project's `SKAdNetworkItems`
directly against the `GOOGLE_SKADNETWORK_IDS` set in the script below.
- **Pass/Fail Criteria**:
- **Fail**:
- Any Google SKAdNetwork ID is missing from the project's
`SKAdNetworkItems`.
- The `SKAdNetworkItems` array is missing entirely.
- **N/A**: Project targets Android or Unity targeting Android.
## Google SKAdNetwork IDs Validation Script
Use the following Python script to check whether the project's file contains all
required Google SKAdNetwork IDs:
```python
import plistlib
import re
import sys
GOOGLE_SKADNETWORK_IDS = {
"22mmun2rn5.skadnetwork",
"2fnua5tdw4.skadnetwork",
"2u9pt9hc89.skadnetwork",
"3qcr597p9d.skadnetwork",
"3qy4746246.skadnetwork",
"3rd42ekr43.skadnetwork",
"3sh42y64q3.skadnetwork",
"4468km3ulz.skadnetwork",
"44jx6755aq.skadnetwork",
"47vhws6wlr.skadnetwork",
"4dzt52r2t5.skadnetwork",
"4fzdc2evr5.skadnetwork",
"578prtvx9j.skadnetwork",
"7ug5zh24hu.skadnetwork",
"8c4e2ghe7u.skadnetwork",
"8s468mfl3y.skadnetwork",
"97r2b46745.skadnetwork",
"9t245vhmpl.skadnetwork",
"a2p9lx4jpn.skadnetwork",
"c3frkrj4fj.skadnetwork",
"c6k4g5qg8m.skadnetwork",
"cp8zw746q7.skadnetwork",
"cstr6suwn9.skadnetwork",
"e5fvkxwrpn.skadnetwork",
"f38h382jlk.skadnetwork",
"gta9lk7p23.skadnetwork",
"hs6bdukanm.skadnetwork",
"k674qkevps.skadnetwork",
"kbd757ywx3.skadnetwork",
"kbmxgpxpgc.skadnetwork",
"klf5c3l5u5.skadnetwork",
"ludvb6z3bs.skadnetwork",
"mlmmfzh3r3.skadnetwork",
"n38lu8286q.skadnetwork",
"p78axxw29g.skadnetwork",
"ppxm28t8ap.skadnetwork",
"s39g8k73mm.skadnetwork",
"su67r6k2v3.skadnetwork",
"t38b2kh725.skadnetwork",
"tl55sbb4fm.skadnetwork",
"uw77j35x4d.skadnetwork",
"v4nxqhlyqp.skadnetwork",
"v72qych5uu.skadnetwork",
"v9wttpbfk9.skadnetwork",
"vutu7akeur.skadnetwork",
"wg4vff78zm.skadnetwork",
"wzmmz9fp6w.skadnetwork",
"y5ghdn5j9k.skadnetwork",
"yclnxrl5pm.skadnetwork",
"ydx93a7ass.skadnetwork",
}
def check_skadnetwork_ids(content: str) -> tuple[bool, set[str]]:
"""Extracts SKAdNetwork IDs and performs a set containment check."""
found_ids = {
match.lower()
for match in re.findall(
r"([a-z0-9]+\.skadnetwork)", content, re.IGNORECASE
)
}
missing_ids = GOOGLE_SKADNETWORK_IDS - found_ids
return len(missing_ids) == 0, missing_ids
def generate_missing_xml(missing_ids: set[str]) -> str:
"""Generates Info.plist XML dict entries for missing identifiers."""
lines = []
for mid in sorted(missing_ids):
lines.append(
f" <dict>\n <key>SKAdNetworkIdentifier</key>\n "
f" <string>{mid}</string>\n </dict>"
)
return "\n".join(lines)
if __name__ == "__main__":
target = sys.argv[1] if len(sys.argv) > 1 else None
if target in ("-h", "--help"):
print("Usage: python script.py [path/to/file]")
print("Validates that all required Google SKAdNetwork IDs are present.")
sys.exit(0)
if target:
try:
with open(target, "rb") as f:
try:
data = plistlib.load(f)
items = data.get("SKAdNetworkItems", [])
found_ids = {
item.get("SKAdNetworkIdentifier", "").lower()
for item in items
if isinstance(item, dict)
}
missing = GOOGLE_SKADNETWORK_IDS - found_ids
passed = len(missing) == 0
except Exception:
f.seek(0)
content = f.read().decode("utf-8", errors="ignore")
passed, missing = check_skadnetwork_ids(content)
except Exception as e:
print(f"Error reading {target}: {e}", file=sys.stderr)
sys.exit(2)
else:
if sys.stdin.isatty():
print(
"Error: No input provided. Provide a file path or pipe content"
" into stdin.",
file=sys.stderr,
)
print(
"Usage: python script.py [path/to/file]",
file=sys.stderr,
)
sys.exit(2)
content = sys.stdin.read()
passed, missing = check_skadnetwork_ids(content)
if passed:
print(
f"PASS: All {len(GOOGLE_SKADNETWORK_IDS)} Google SKAdNetwork IDs"
" are present."
)
sys.exit(0)
else:
print(f"FAIL: Missing {len(missing)} Google SKAdNetwork IDs:")
for mid in sorted(missing):
print(f" {mid}")
sys.exit(1)
```
### Adding Missing Identifiers
To resolve missing identifiers:
- **iOS**: Add each missing ID to `Info.plist`:
```xml
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>{missing_id}</string>
</dict>
</array>
```
- **Unity**: Add each missing ID to `GoogleMobileAdsSKAdNetworkItems.xml`:
```xml
<SKAdNetworkItems>
<SKAdNetworkIdentifier>{missing_id}</SKAdNetworkIdentifier>
</SKAdNetworkItems>
``` mediation-adapter-compatibility.md 2.0 KB
# Mediation adapter compatibility
- **Follow These Steps**:
- [ ] Analyze the dependencies in the project build files.
- [ ] Determine how the GMA SDK version is declared:
- **Explicitly Declared**:
- **Android**: Direct dependency on
`com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk`.
- **iOS**: Direct dependency on `Google-Mobile-Ads-SDK`
(CocoaPods) or `GoogleMobileAds` (Swift Package Manager).
- **Unity**: The GMA Unity Plugin is installed and declares
Android/iOS GMA SDK dependencies in
`GoogleMobileAdsDependencies.xml` or with UPM package.
- **Transitive Dependency**: The GMA SDK is pulled in by mediation
adapter dependencies.
- [ ] Identify the Android and iOS GMA SDK versions required by all
mediation adapters in the project.
- [ ] Compare the major and minor GMA SDK version requirements of all
mediation adapters against the explicitly declared GMA SDK version in
the project.
- **Pass/Fail Criteria**:
- **Fail**:
- Any mediation adapter requires a GMA SDK major version higher or
lower than the core GMA SDK version in the project.
- *Example*: The project explicitly requests GMA SDK 24.3.0, but
an adapter requires GMA SDK 25.0.0 (or 23.0.0).
- Mediation adapters require different GMA SDK major versions from
each other.
- **Warning**:
- All adapters rely on the same GMA SDK major version but the project
doesn't explicitly declare a GMA SDK version, relying on a
transitive dependency.
- Any mediation adapter requires a GMA SDK minor version higher than
the GMA SDK version declared in the project, while sharing the same
major version.
- *Example*: GMA SDK in the project is 13.6.0, but an adapter
requires 13.7.0.
- **N/A**: The project does not use any mediation adapters.
License (Apache-2.0)
View full license text
Licensed under the Apache License, Version 2.0. See https://github.com/google/skills/blob/main/LICENSE