1.3.2 • Published 2 years ago

@dcardsdk/web-ad-tracking-sdk v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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 @dcardsdk/web-ad-tracking-sdk
yarn add @dcardsdk/web-ad-tracking-sdk
  1. Import @dcardsdk/web-ad-tracking-sdk
import entry from '@dcardsdk/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(){const d=function(n,...e){d.queue.push([n,...e])};d.queue=[],window.dadk=window.dadk||d;const n=document.createElement("script");n.src="https://unpkg.com/@dcardsdk/web-ad-tracking-sdk",document.head.append(n),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 "public-ts-declaration-url" -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/@dcardsdk/web-ad-tracking-sdk/build/types/index.d.ts

Show your support

Give a ⭐️ if this project helped you!


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

2.4.1

1 year ago

2.4.0

1 year ago

2.4.3

1 year ago

2.4.2

1 year ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago