Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

@dcard/web-ad-tracking-sdk

Package Overview
Dependencies
5
Maintainers
7
Versions
9
Issues
File Explorer

Advanced tools

@dcard/web-ad-tracking-sdk

The public advertising tracking SDK for web environments powered by Dcard Inc.

    2.4.0latest
    GitHub

Version published
Maintainers
7
Weekly downloads
605
decreased by-7.91%

Weekly downloads

Readme

Source

Welcome to Dcard Web AD Tracking SDK 👋

NPM version License: MIT

The advertising tracking SDK for web environments powered by Dcard Inc.

🏠 Homepage

Install & Usage

Integrate tracking SDK into your codebase (Support typing automatically in IDE like vscode)

  1. Install @dcard/web-ad-tracking-sdk
yarn add @dcard/web-ad-tracking-sdk
  1. Import @dcard/web-ad-tracking-sdk
import entry from '@dcard/web-ad-tracking-sdk' // Substitute the real client ID for CLIENT_ID issued by Dcard. entry('init', 'CLIENT_ID'); entry('track', 'PageView', { url: window.location.href });

OR embed the SDK in the HTML file

  1. Copy and paste the following script tag into the HTML file to initialize the web tracking SDK.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Embedding SDK example</title> <script>!function(){var d=function d(a){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];d.queue.push([a].concat(n))};d.queue=[],window.dadk=window.dadk||d;var a=document.createElement("script");a.src="undefined"!=typeof URLSearchParams?"https://unpkg.com/@dcard/web-ad-tracking-sdk/build/dadk.iife.js":"https://unpkg.com/@dcard/web-ad-tracking-sdk/build/outdated-dadk.iife.js",document.head.appendChild(a),window.dadk("init","CLIENT_ID"),window.dadk("track","PageView",{url:window.location.href})}(); </script> </head> <body></body> </html>
  1. Fetch the latest type declaration file
curl -Ls "https://unpkg.com/@dcard/web-ad-tracking-sdk/build/types/dadk.d.ts" -o types/dadk.d.ts
  1. Place the following triple-slash directive to enable typing system in JS files(It must be the first line of the file).
/// <reference path="types/dadk.d.ts" /> // Assume the types folder is at the same level as this script. window.dadk('track', 'AddToCart', { 'contents': { test: '123' } })

Typing Demo

Interface

https://unpkg.com/@dcard/web-ad-tracking-sdk/build/types/dadk.d.ts

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

FAQs

Last updated on 01 Dec 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc