-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored our head code to support passing a cause into Raptive
- Loading branch information
Spicer Matthews
committed
Mar 12, 2024
1 parent
fa2f67c
commit 68f9f50
Showing
3 changed files
with
327 additions
and
291 deletions.
There are no files selected for viewing
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
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,44 @@ | ||
/* eslint react/no-danger: 0 */ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
export default function Raptive({ causeId }) { | ||
return ( | ||
<> | ||
<script | ||
dangerouslySetInnerHTML={{ | ||
__html: `(function(w, d) { | ||
w.adthrive = w.adthrive || {}; | ||
w.adthrive.cmd = w.adthrive.cmd || []; | ||
w.adthrive.plugin = 'adthrive-ads-manual'; | ||
w.adthrive.host = 'ads.adthrive.com'; | ||
var s = d.createElement('script'); | ||
s.async = true; | ||
s.referrerpolicy='no-referrer-when-downgrade'; | ||
s.src = 'https://' + w.adthrive.host + '/sites/655cd66352dfc71af0778a48/ads.min.js?referrer=' + w.encodeURIComponent(w.location.href) + '&cb=' + (Math.floor(Math.random() * 100) + 1); | ||
var n = d.getElementsByTagName('script')[0]; | ||
n.parentNode.insertBefore(s, n); | ||
})(window, document);`, | ||
}} | ||
/> | ||
|
||
<script | ||
dangerouslySetInnerHTML={{ | ||
__html: `(function() { | ||
window.adthrive.cmd.push(function() { | ||
window.adthrive.siteAds.targeting.push( {key: 'at_custom_1', value: '${causeId}'} ); | ||
}); | ||
})();`, | ||
}} | ||
/> | ||
</> | ||
) | ||
} | ||
|
||
Raptive.propTypes = { | ||
causeId: PropTypes.string, | ||
} | ||
|
||
Raptive.defaultProps = { | ||
causeId: '', | ||
} |
Oops, something went wrong.