From eebcad09feecd2dc6cc9004c723fdccc3487fe85 Mon Sep 17 00:00:00 2001 From: Nick Santaniello Date: Tue, 30 Apr 2024 18:53:30 -0400 Subject: [PATCH] Removed legacy moat code and added new tag, new component with script tag --- .../src/components/moat-tracking.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 packages/react-components/src/components/moat-tracking.tsx diff --git a/packages/react-components/src/components/moat-tracking.tsx b/packages/react-components/src/components/moat-tracking.tsx new file mode 100644 index 00000000..7398cc3e --- /dev/null +++ b/packages/react-components/src/components/moat-tracking.tsx @@ -0,0 +1,16 @@ +import React from 'react' +import { constructMoatData } from '@giphy/js-util' + +type Props = { bottleData: any } + +export const MoatTracking = ({ bottleData }: Props) => { + const moatCompatibleData = constructMoatData(bottleData as any) + // Constructing the URL with macros replaced by their values + const url = `https://z.moatads.com/giphyjsdisplay626459778035/moatad.js#${Object.entries(moatCompatibleData) + .map(([key, value]) => `${key}=${value}`) + .join('&')}` + const scriptTag = + return scriptTag +} + +export default MoatTracking