firebase-dynamic-links
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    Firebase Dynamic Links

    npm

    Overview

    This package provides a wrapper for Firebase Dynamic Links and View Dynamic Links Analytics Data REST APIs. It aims to define types for this APIs.

    In order to use this package, you can read Short Link API and Analytics API full API documentations.

    Installation

    The Firebase Dynamic Links is available on npm as firebase-dynamic-links:

    $ npm install --save firebase-dynamic-links
    

    Usage

    Setup

    Take note of your project Web Api Key from setting page of the Firebase console. Import the package and then create an instance of the FirebaseDynamicLinks as follow:

    import { FirebaseDynamicLinks } from 'firebase-dynamic-links';
    
    const firebaseDynamicLinks = new FirebaseDynamicLinks(/* Web Api Key */);
    

    Examples

    Create Dynamic Links

    Create a short link from a long link
    const { shortLink, previewLink } = await firebaseDynamicLinks.createLink({
      longDynamicLink: 'https://example.page.link/?link=https://www.example.com/&apn=com.example.android&ibi=com.example.ios',
    });
    
    Create a short link from parameters
    const { shortLink, previewLink } = await firebaseDynamicLinks.createLink({
      dynamicLinkInfo: {
        domainUriPrefix: 'https://example.page.link',
        link: 'https://www.example.com/',
        androidInfo: {
          androidPackageName: 'com.example.android',
        },
        iosInfo: {
          iosBundleId: 'com.example.ios',
        },
      },
    });
    
    Set the length of a short Dynamic Link
    const { shortLink, previewLink } = await firebaseDynamicLinks.createLink({
      longDynamicLink: 'https://example.page.link/?link=http://www.example.com/&apn=com.example.android&ibi=com.example.ios',
      suffix: {
        option: 'UNGUESSABLE',
      },
    });
    

    View Dynamic Links Analytics Data

    Get statistics for a single Dynamic Link
    const { linkEventStats } = await firebaseDynamicLinks.getLinkStats('https://example.page.link/wXYz', 7, accessToken);
    

    Install

    npm i firebase-dynamic-links

    DownloadsWeekly Downloads

    9,990

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    17 kB

    Total Files

    11

    Last publish

    Collaborators

    • mosius