mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: unique tagging
This commit is contained in:
1 parent
1e36a24aff
commit
fa4c1cea56
1 file changed
+9
-3
@@ -1,6 +1,7 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { ComponentProps, useEffect } from 'react';
|
import { uniqueId } from 'lodash';
|
||||||
|
import { ComponentProps, useEffect, useRef } from 'react';
|
||||||
|
|
||||||
export enum AdType {
|
export enum AdType {
|
||||||
TankopediaHorizontal800 = 738182777,
|
TankopediaHorizontal800 = 738182777,
|
||||||
@@ -11,11 +12,16 @@ interface AdProps extends ComponentProps<'div'> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Ad({ type, ...props }: AdProps) {
|
export function Ad({ type, ...props }: AdProps) {
|
||||||
|
const id = useRef(uniqueId());
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(window as any).msAdsQueue.push(function () {
|
(window as any).msAdsQueue.push(function () {
|
||||||
(window as any).mmnow.render({ adUnitId: type, elementId: type });
|
(window as any).mmnow.render({
|
||||||
|
adUnitId: type,
|
||||||
|
elementId: `${type}-${id.current}`,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return <div id={`${type}`} {...props} />;
|
return <div id={`${type}-${id.current}`} {...props} />;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user