This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Konstantinos/DERC-2262/Datalayer issue fix + partytown integration (#…
…6068) * fix: performance * fix: hero images optimized --------- Co-authored-by: “konstantinosG-deriv” <“[email protected]”>
- Loading branch information
1 parent
9aabd45
commit 1076bcc
Showing
16 changed files
with
67 additions
and
34 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 |
---|---|---|
@@ -1,42 +1,55 @@ | ||
import React from 'react' | ||
import { Partytown } from '@builder.io/partytown/react' | ||
import { WrapPagesWithLocaleContext } from './src/components/localization' | ||
import './src/components/localization/config' | ||
import GlobalProvider from './src/store/global-provider' | ||
|
||
export const wrapRootElement = ({ element }) => { | ||
return <GlobalProvider>{element}</GlobalProvider> | ||
return <GlobalProvider>{element}</GlobalProvider> | ||
} | ||
|
||
export const wrapPageElement = WrapPagesWithLocaleContext | ||
|
||
export const onRenderBody = ({ setHeadComponents }) => { | ||
const gtmTrackingId = process.env.GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID || '' | ||
const gtmTrackingId = process.env.GATSBY_GOOGLE_TAG_MANAGER_TRACKING_ID || '' | ||
|
||
setHeadComponents([ | ||
<script | ||
key="partytown-vanilla-config" | ||
dangerouslySetInnerHTML={{ | ||
__html: `partytown = { | ||
resolveUrl(url, location) { | ||
// Use a secure connection | ||
if (url?.protocol === 'http:') { | ||
url = new URL(url.href.replace('http', 'https')) | ||
} | ||
// Point to our proxied URL | ||
const proxyUrl = new URL(location.origin + '/__third-party-proxy') | ||
proxyUrl.searchParams.append('url', url) | ||
return proxyUrl | ||
} | ||
}`, | ||
}} | ||
/>, | ||
gtmTrackingId && ( | ||
<script | ||
key="gtm-script" | ||
dangerouslySetInnerHTML={{ | ||
__html: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl+'';f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer', '${gtmTrackingId}');`, | ||
}} | ||
/> | ||
), | ||
]) | ||
} | ||
setHeadComponents([ | ||
// Partytown setup | ||
<Partytown key="partytown" />, | ||
<script | ||
key="partytown-vanilla-config" | ||
dangerouslySetInnerHTML={{ | ||
__html: `partytown = { | ||
resolveUrl(url, location) { | ||
// Use a secure connection | ||
if (url?.protocol === 'http:') { | ||
url = new URL(url.href.replace('http', 'https')) | ||
} | ||
// Point to our proxied URL | ||
const proxyUrl = new URL(location.origin + '/__third-party-proxy') | ||
proxyUrl.searchParams.append('url', url) | ||
return proxyUrl | ||
} | ||
}`, | ||
}} | ||
/>, | ||
|
||
// GTM setup | ||
gtmTrackingId && ( | ||
<script | ||
key="gtm-script" | ||
type="text/partytown" | ||
async | ||
src={`https://www.googletagmanager.com/gtm.js?id=${gtmTrackingId}`} | ||
></script> | ||
), | ||
gtmTrackingId && ( | ||
<script | ||
key="gtm-script" | ||
dangerouslySetInnerHTML={{ | ||
__html: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl+'';f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer', '${gtmTrackingId}');`, | ||
}} | ||
/> | ||
), | ||
]) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1076bcc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
deriv-com – ./
deriv-com.binary.sx
deriv-com-git-master.binary.sx