-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed legacy moat code and added new tag, new component with script…
… tag
- Loading branch information
1 parent
41f363d
commit eebcad0
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
packages/react-components/src/components/moat-tracking.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = <script src={url} type="text/javascript"></script> | ||
return scriptTag | ||
} | ||
|
||
export default MoatTracking |