npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vladikstyle/react-native-apple-ads-attribution

v1.0.3

Published

Fetches apple attribution data via NEW AdServices APIs

Downloads

82

Readme

react-native-apple-ads-attribution

Fetches apple attribution data via AdServices APIs. (iAd services is deprecated and getting error in XCODE 16. That is reason i removed all references to iAd from this npm.)

Requirements

  • AdServices Framework

Installation

npm install @vladikstyle/react-native-apple-ads-attribution

Usage

import AppleAdsAttribution from "@vladikstyle/react-native-apple-ads-attribution";

const attributionData = await AppleAdsAttribution.getAttributionData();
const adServicesAttributionToken = await AppleAdsAttribution.getAdServicesAttributionToken();
const adServicesAttributionData = await AppleAdsAttribution.getAdServicesAttributionData();

Note from version 1.0 the above functions propagates errors, so they should be wrapped in try/catch.

Documentation

getAttributionData()

Gets install attribution data first trying to use the AdServices API (iOS 14.3+).
If it fails to retrieve data it will fallback to iAd API. Throws error if everything fails

Example
try {
  const iAdAttributionData = await AppleAdsAttribution.getiAdAttributionData()
  console.log(iAdAttributionData) // -->
    // {
    //   "Version3.1": {
    //     "iad-lineitem-name": "LineName",
    //     "iad-attribution": "true",
    //     "iad-campaign-name": "CampaignName",
    //     "iad-org-name": "OrgName",
    //     "iad-conversion-type": "Download",
    //     "iad-org-id": "1234567890",
    //     "iad-campaign-id": "1234567890",
    //     "iad-adgroup-name": "AdGroupName",
    //     "iad-country-or-region": "US",
    //     "iad-creativeset-name": "CreativeSetName",
    //     "iad-keyword-matchtype": "Broad",
    //     "iad-conversion-date": "2021-04-07T12:14:04Z",
    //     "iad-creativeset-id": "1234567890",
    //     "iad-keyword-id": "12323222",
    //     "iad-lineitem-id": "1234567890",
    //     "iad-click-date": "2021-04-07T12:14:04Z",
    //     "iad-purchase-date": "2021-04-07T12:14:04Z",
    //     "iad-adgroup-id": "1234567890",
    //     "iad-keyword": "Keyword"
    //   }
    // }
} catch (error) {
  const { message } = error
  console.log(message) // --> Some error message
}

getAdServicesAttributionToken()

Generates a AdServices token valid for 24 hours that then can be used to request attribution data from Apples AdServices API, see https://developer.apple.com/documentation/adservices
Throws error if token couldn't be generated

Example
try {
  const adServicesAttributionToken = await AppleAdsAttribution.getAdServicesAttributionToken()
  console.log(adServicesAttributionToken) // -->
    // KG6LvapO97gCkOfUqi412/n8v8fu8AMTB.....
} catch (error) {
  const { message } = error
  console.log(message) // --> Some error message
}

getAdServicesAttributionData()

Generates a AdServices token and uses it to request attribution data from Apples AdServices API, see https://developer.apple.com/documentation/adservices
Throws error if data couldn't be fetched.

Example
try {
  const adServicesAttributionData = await AppleAdsAttribution.getAdServicesAttributionData()
  console.log(adServicesAttributionData) // -->
    // {
    //   "keywordId": 12323222,
    //   "campaignId": 1234567890,
    //   "conversionType": "Download",
    //   "creativeSetId": 1234567890,
    //   "orgId": 1234567890,
    //   "countryOrRegion": "US",
    //   "adGroupId": 1234567890,
    //   "clickDate": "2021-04-08T07:45Z",
    //   "attribution": true
    // }
catch (error) {
  const { message } = error
  console.log(message) // --> Some error message
}

License

MIT