Welcome to Dcard Web AD Tracking SDK 👋
The advertising tracking SDK for web environments powered by Dcard Inc.
Install & Usage
Integrate tracking SDK into your codebase (Support typing automatically in IDE like vscode)
- Install @dcard/web-ad-tracking-sdk
yarn add @dcard/web-ad-tracking-sdk
- Import @dcard/web-ad-tracking-sdk
import entry from '@dcard/web-ad-tracking-sdk'
entry('init', 'CLIENT_ID');
entry('track', 'PageView', { url: window.location.href });
OR embed the SDK in the HTML file
- 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")}();
</script>
</head>
<body></body>
</html>
- 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
- Place the following triple-slash directive to enable typing system in JS files(It must be the first line of the file).
window.dadk('track', 'AddToCart', { 'contents': { test: '123' } })
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