@vdaluz/astro-affiliate 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,7 +15,7 @@ Alternatively, a pinned https tarball from a tag works too, with no registry inv
15
15
  ```jsonc
16
16
  // package.json
17
17
  "dependencies": {
18
- "@vdaluz/astro-affiliate": "https://github.com/vdaluz/astro-affiliate/archive/refs/tags/v0.5.1.tar.gz"
18
+ "@vdaluz/astro-affiliate": "https://github.com/vdaluz/astro-affiliate/archive/refs/tags/v0.6.0.tar.gz"
19
19
  }
20
20
  ```
21
21
 
@@ -176,6 +176,15 @@ import { affiliate } from '../config/affiliate';
176
176
 
177
177
  Renders `target="_blank" rel="noopener noreferrer sponsored"` by default. Pass `class` to style it, or `channel` to target a per-channel tag/link (see [Per-channel tags](#per-channel-tags-reposts-syndication)) - falls back to the program's default when omitted or unconfigured for that channel.
178
178
 
179
+ ### Click tracking
180
+
181
+ `<AffiliateLink>` renders `data-affiliate-key`, `data-affiliate-channel` (omitted when no `channel`
182
+ prop is passed), and `data-affiliate-program` on the anchor. This package emits no click events
183
+ itself - it's a data-attribute contract a consumer's own analytics wiring can read. See
184
+ [`@vdaluz/astro-opt-in-analytics`'s README](https://github.com/vdaluz/astro-opt-in-analytics#affiliate-click-tracking)
185
+ for `bindAffiliateClickTracking()`, which reads these attributes and reports an `affiliate-click`
186
+ event once analytics consent is granted.
187
+
179
188
  ## Disclosure (`<AffiliateDisclosure>`)
180
189
 
181
190
  Render at the **top** of the post body, above any affiliate links (FTC: disclosure before links,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vdaluz/astro-affiliate",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "FTC-compliant affiliate-link catalog resolver and disclosure components - proven in production on vdaluz.com and imperfectsystems.com.",
5
5
  "keywords": [
6
6
  "astro",
@@ -12,9 +12,17 @@ interface Props {
12
12
  }
13
13
 
14
14
  const { config, affiliateKey, channel, class: className } = Astro.props;
15
- const { url } = resolveAffiliate(config, affiliateKey, channel);
15
+ const { url, program } = resolveAffiliate(config, affiliateKey, channel);
16
16
  ---
17
17
 
18
- <a href={url} target="_blank" rel="noopener noreferrer sponsored" class={className}>
18
+ <a
19
+ href={url}
20
+ target="_blank"
21
+ rel="noopener noreferrer sponsored"
22
+ class={className}
23
+ data-affiliate-key={affiliateKey}
24
+ data-affiliate-channel={channel}
25
+ data-affiliate-program={program}
26
+ >
19
27
  <slot />
20
28
  </a>