This repository was archived by the owner on Feb 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
templates/_common/components Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change
1
+ const Cookies = require ( 'js-cookie' ) ;
1
2
const getElementById = require ( '../../_common/common_functions' ) . getElementById ;
2
3
const createElement = require ( '../../_common/utility' ) . createElement ;
4
+ const getLanguage = require ( '../../_common/language' ) . get ;
3
5
4
6
const DerivBanner = ( ( ) => {
5
7
let el_multiplier_banner_container ,
6
- el_close_button ;
8
+ el_close_button ,
9
+ multiplier_link ;
7
10
8
11
const onLoad = ( ) => {
9
12
const is_deriv_banner_dismissed = localStorage . getItem ( 'is_deriv_banner_dismissed' ) ;
10
13
11
14
if ( ! is_deriv_banner_dismissed ) {
15
+ const affiliate_cookie = Cookies . getJSON ( 'affiliate_tracking' ) ;
16
+ let affiliate_token ;
17
+
18
+ if ( affiliate_cookie ) affiliate_token = affiliate_cookie . t ;
19
+ else {
20
+ const queryString = window . location . search ;
21
+ const urlParams = new URLSearchParams ( queryString ) ;
22
+ affiliate_token = urlParams . get ( 't' ) ;
23
+ }
24
+
12
25
el_multiplier_banner_container = getElementById ( 'multiplier_banner_container' ) ;
26
+ multiplier_link = getElementById ( 'multiplier-link' ) ;
27
+
28
+ const lang = getLanguage ( ) . toLowerCase ( ) ;
29
+ const multiplier_href = `https://deriv.com/${ lang } /trade-types/multiplier/?utm_source=binary&utm_medium=referral&utm_campaign=ww-banner-deriv-1020-en&utm_content=multiplier-banner-synthetic-indices-amplified` ;
30
+
31
+ multiplier_link . href = affiliate_token ? `${ multiplier_href } &t=${ affiliate_token } ` : multiplier_href ;
32
+
13
33
el_multiplier_banner_container . setVisibility ( 1 ) ;
14
34
el_close_button = el_multiplier_banner_container . querySelector ( '.deriv_banner_close' ) || createElement ( 'div' ) ;
15
35
el_close_button . addEventListener ( 'click' , onClose ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
4
4
const DerivBanner = ( { has_margin } ) => (
5
5
< div id = 'multiplier_banner_container' className = { `invisible ui-helper-clearfix ${ has_margin ? 'has_margin' : '' } ` } >
6
- < a target = '_blank' rel = 'noopener noreferrer' href = { ` ${ it . deriv_banner_url } trade-types/multiplier/?utm_source=binary&utm_medium=referral&utm_campaign=ww-banner-deriv-1020-en&utm_content=multiplier-banner-synthetic-indices-amplified` } >
6
+ < a id = 'multiplier-link' target = '_blank' rel = 'noopener noreferrer' href = '#' >
7
7
< div className = 'multiplier_banner_title' >
8
8
< img className = 'multiplier_banner_logo' src = { it . url_for ( 'images/deriv/deriv-logo.svg' ) } />
9
9
< h3 > { it . L ( 'Multipliers' ) } </ h3 >
You can’t perform that action at this time.
0 commit comments