{"id":20936215,"url":"https://github.com/adzerk/adzerk-android-sdk","last_synced_at":"2025-05-13T21:31:00.923Z","repository":{"id":46261514,"uuid":"39108864","full_name":"adzerk/adzerk-android-sdk","owner":"adzerk","description":"Access Adzerk's ad serving APIs via Android","archived":false,"fork":false,"pushed_at":"2024-02-26T21:01:08.000Z","size":508,"stargazers_count":4,"open_issues_count":1,"forks_count":5,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-04-02T08:11:13.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.adzerk.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adzerk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-15T01:12:13.000Z","updated_at":"2022-01-18T18:24:15.000Z","dependencies_parsed_at":"2022-08-28T23:31:48.057Z","dependency_job_id":null,"html_url":"https://github.com/adzerk/adzerk-android-sdk","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adzerk%2Fadzerk-android-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adzerk%2Fadzerk-android-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adzerk%2Fadzerk-android-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adzerk%2Fadzerk-android-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adzerk","download_url":"https://codeload.github.com/adzerk/adzerk-android-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254030898,"owners_count":22002670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T22:18:24.779Z","updated_at":"2025-05-13T21:30:59.077Z","avatar_url":"https://github.com/adzerk.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Adzerk Android SDK\n\nAn Android SDK for the Adzerk Native and UserDB APIs\n\n## Download\n\nGrab via gradle\n\n```gradle\nimplementation 'com.adzerk:sdk:2.3.+'\n```\n\nThe SDK uses Java 8 and supports a minimum Android 5.1 (API level 22).\n\nTo target a client application with minimum SDK \u003c26, refer to the [Android Java 8 support documentation](https://developer.android.com/studio/write/java8-support).\n\n## Usage\n\nCreate an instance of the AdzerkSdk for your `networkId`:\n\n```kotlin\nAdzerkSdk sdk = new AdzerkSdk.Builder().networkId(23L).build();\n```\n\nCreate an instance of the AdzerkSdk and also provide a hostname:\n\n```kotlin\nAdzerkSdk sdk = new AdzerkSdk.Builder().networkId(23L).hostname(\"custom.host.com\").build();\n```\n\nBuild a request for placements\n\n```kotlin\nRequest request = new Request.Builder()\n      .addPlacement(new Placement(\"div1\", \u003csite_id\u003e, \u003cad_types...\u003e))\n      .addPlacement(new Placement(\"div2\", \u003csite_id\u003e, \u003cad_types...\u003e))\n      .addPlacement(new Placement(\"div3\", \u003csite_id\u003e, \u003cad_types...\u003e))\n      .build();\n```\n\nSubmit the request and get a callback for the response\n\n```kotlin\nsdk.requestPlacement(request, listener);\n```\n\nGet content and decisions from the response\n\n```kotlin\n@Override\npublic void success(Response response) {\n    Decision firstDecision = response.getDecisions(\"div1\").get(0);\n    // ...\n}\n```\n\n@since SDK v2.2.0+\n\n## Recording Impression \u0026 Clicks\n\nUse with the fetch ad example above.\n\n```kotlin\n// Impression pixel; fire when user sees the ad\nString impUrl = decision.getImpressionUrl();\nsdk.firePixel(impUrl, listener);\n```\n\n```kotlin\n// Click pixel; fire when user clicks on the ad\nString clickUrl = decision.getClickUrl();\nsdk.firePixel(clickUrl, listener);\n```\n\nModifying the revenue\n```kotlin\n// Click pixel; fire when user clicks on the ad and modify the click revenue\n//   OVERRIDE: replaces the revenue value of the click/event \n//   ADDITIONAL: adds the specified value to the original revenue value of the click/event\nString clickUrl = decision.getClickUrl();\nsdk.firePixel(clickUrl, revenue, RevenueModifierType.OVERRIDE, null, listener);\n```\n\nSetting the gross merchandise value for the event. \n```kotlin\n// Click pixel; fire when user clicks on the ad and modify the click revenue\n//   OVERRIDE: replaces the revenue value of the click/event \n//   ADDITIONAL: adds the specified value to the original revenue value of the click/event\nString clickUrl = decision.getClickUrl();\nFloat grossMerchandiseValue = 1.5f;\nsdk.firePixel(clickUrl, revenue, RevenueModifierType.ADDITIONAL, grossMerchandiseValue, listener);\n```\n\nHandle the fire pixel response\n```kotlin\n// status: HTTP status code\n// location: click target URL\n@Override\npublic void success(FirePixelResponse response) {\n   Log.d(TAG, \"Fired! \" +\n      \"status: \" + response.getStatusCode() + \" \" +\n      \"location: \" + response.getLocation());\n}\n```\n\n## Additional Options\nAdditional optional parameters supported by the API may be specified via the Builder on the Request or Placement.\n\nExample: to specify eCPM partitions for a Placement:\n\n```kotlin\nString[] ecpmPartitions = new String[]{\"main\", \"detail\", \"footer\"};\nRequest request = new Request.Builder()\n    .addPlacement(new Placement(\"div1\", 1133898L, 163)\n        .setCount(ecpmPartitions.length)\n        .addAdditionalOption(\"ecpmPartitions\", ecpmPartitions))\n    .build();\n```\n\n@since SDK v2.1.0+\n\n## Distance Targeting\n\nDistance Targeting is supported via Additional Options on the request.\n\n```kotlin\nval request = new Request.Builder()\n    .addPlacement(Placement(\"div1\", 1133898, (163)))\n    .addAdditionalOption(\"intendedLatitude\", 35.91868)\n    .addAdditionalOption(\"intendedLongitude\", -78.96001)\n    .addAdditionalOption(\"radius\", 50)\n    .build()\n```\n\n## Multi-Winner Placements\nA multi-winner placement returns multiple selections inside a single placement object.\n\nTo request multiple winners, specify a count for the Placement object. This requests the maximum number of winners (selections) that can be included in the placement.\n\n```kotlin\nRequest request = new Request.Builder()\n   .addPlacement(new Placement(\"div1\", \u003csite_id\u003e, \u003cad_types...\u003e).setCount(3))\n   .build();\n```\n\n@since SDK v2.0.0+\n\n## GDPR Consent\n\nConsent preferences can be specified when building a request. For example, to set GDPR consent for tracking in the European Union (this defaults to false):\n\n```kotlin\nRequest request = new Request.Builder(placements)\n    .setUser(new User(key))\n    .setConsent(new Consent(true))\n    .build();\n```\n\n@since SDK v0.4.0+\n\n## Building\nUse gradlew to build library archive\n\n```\n./gradlew assemble\n```\noutput: `sdk/build/outputs/aar`\n\n## Testing\nRun unit tests\n\n```\n./gradlew test\n```\nSpecify `--rerun-tasks` to rerun up-to-date tests. To view test reports see:\n\noutput: `sdk/build/reports/tests`\n\n## Documentation\nGenerate the SDK documentation\n\n```\n./gradlew javadoc\n```\n\noutput: `sdk/build/docs/javadoc`\n\n## Publishing\nUpdate the version string properties in `sdk/build.gradle`\n\nEither get a copy of the Kevel Engineering signing key or generate a new signing key using the instructions here:\n\nhttps://blog.sonatype.com/2010/01/how-to-generate-pgp-signatures-with-maven/\n\nUpdate `~/.gradle/gradle.properties` with your signing information.\n\n```\n./gradlew uploadArchive\n```\n\nLogin in to Sonatype OSS, locate the staging package, close, and release it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadzerk%2Fadzerk-android-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadzerk%2Fadzerk-android-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadzerk%2Fadzerk-android-sdk/lists"}