You are on page 1of 5

<!

DOCTYPE HTML>
<head>
<title>Lazada Online Shopping</title>

<meta charset="utf-8" />


<meta name="viewport" content="width=device-width, initial-scale=1, maximum-
scale=1, user-scalable=no" />
<!--[if lte IE 9]><link rel="stylesheet" href="//laz-g-
cdn.alicdn.com/lzd/assets/0.0.5/dpl-buyeruikit/1.7.0/next-noreset-2.css" /><!
[endif]-->
<script type = "text/javascript">
'use strict';const iosStore='itms-apps://itunes.apple.com/app/id785385147?
mt=8';const androidStore='market://details?id=com.lazada.android';const
logUrl='http://sg.mmstat.com/mkt.clickserver.sml?action=';const
openalert='__openalert';const DEEP_LINK={hp:'lazada://{venture}',shop:'lazada://
{venture}/shop/{sellerKey}',pdp:'lazada://{venture}/pdp?
itemId={itemId}&skuId={skuId}',search:'lazada://{venture}/search?
phrase={keyword}',campaign:'lazada://{venture}/web/{subdomain}{path}',};const
LOG_ACTION_TYPE={openDeeplink:'open_deep_link',openAppstore:'open_appstore',clickAn
droidBtn:'click_android_btn',clickIosBtn:'click_ios_btn',cpsFallback:'cps_fallback'
,androidChromeFallback:'android_chrome_fallback',}
const DEEP_LINK_REG=/(\{[a-zA-Z]\w+\})/g;const
PageType={hp:'hp',shop:'shop',pdp:'pdp',search:'search',campaign:'campaign',unknown
:'unknown',}
function getPageType(lpUrl){let lpUrlFormat=null;try{lpUrlFormat=new
URL(lpUrl);}catch(e){console.log(e);if(window.location.href.indexOf(openalert)>0)
{alert(e);}
return PageType.unknown;}
if(lpUrlFormat.pathname=='/'){return PageType.hp;}else
if(lpUrlFormat.pathname.startsWith("/shop/")){return PageType.shop;}else
if(lpUrlFormat.pathname.startsWith("/products/")){return PageType.pdp;}else
if(lpUrlFormat.pathname.startsWith("/catalog/")){return PageType.search;}else
if(lpUrlFormat.pathname.startsWith("/wow/")){return PageType.campaign;}
return PageType.unknown;}
function setCookie(key,value,attributes){const
defaults={};attributes=Object.assign({path:'/',},defaults,attributes);if(typeof
attributes.expires==='number'){const expires=new
Date();expires.setTime(expires.getTime()
+attributes.expires*1000);attributes.expires=expires;}
let result;attributes.expires=attributes.expires?
attributes.expires.toUTCString():'';try{result=JSON.stringify(value);if(/^[\{\
[]/.test(result)){value=result;}}catch(e){console.log(e);}
let stringifiedAttributes='';for(const attributeName in attributes)
{if(!attributes[attributeName]){continue;}
stringifiedAttributes+=`;$
{attributeName}`;if(attributes[attributeName]===true){continue;}
stringifiedAttributes+=`=${attributes[attributeName]}`;}
return(document.cookie=`${key} = ${value}${stringifiedAttributes}`);}
function getCookie(key,options={}){let result=key?null:{};const
cookies=document.cookie?document.cookie.split('; '):[];for(let
i=0;i<cookies.length;i++){const parts=cookies[i].split('=');let
cookie=parts.slice(1).join('=');if(!options.json&&cookie.charAt(0)==='"')
{cookie=cookie.slice(1,-1);}
const name=parts[0];if(options.json)
{try{cookie=JSON.parse(cookie);}catch(e){console.error(e);}}
if(key===name){result=cookie;break;}
if(!key){result[name]=cookie;}}
return result;}
function appendExlaz(url){let queryUrl=url;const
exlaz=getEXLazData();if(exlaz&&queryUrl&&queryUrl.indexOf('exlaz')<0)
{queryUrl+=`&exlaz=${encodeURIComponent(exlaz)}`;}
return queryUrl;}
function sendGoldlog(action,venture){let url=logUrl+action+"&t="+new
Date().getTime()+"&country="+venture;const img=new Image();img.src=url;}
function getBrowser(){const ua=window.navigator.userAgent;let matched;let
browser={};if((matched=ua.match(/(?:UCWEB|UCBrowser\/)([\d\.]+)/)))
{browser={name:'UC',isUC:true,version:matched[1],};}else
if((matched=ua.match(/MQQBrowser\/([\d\.]+)/)))
{browser={name:'QQ',isQQ:true,version:matched[1],};}else if((matched=ua.match(/
(?:Firefox|FxiOS)\/([\d\.]+)/)))
{browser={name:'Firefox',isFirefox:true,version:matched[1],};}else
if((matched=ua.match(/MSIE\s([\d\.]+)/))||(matched=ua.match(/IEMobile\/([\d\.]
+)/))){browser={version:matched[1],};if(ua.match(/IEMobile/))
{browser.name='IEMobile';browser.isIEMobile=true;}else{browser.name='IE';browser.is
IE=true;}
if(ua.match(/Android|iPhone/)){browser.isIELikeWebkit=true;}}else
if((matched=ua.match(/(?:Chrome|CriOS)\/([\d\.]+)/)))
{browser={name:'Chrome',isChrome:true,version:matched[1],};if((matched=ua.match(/Op
era|OPR\//))){browser={name:'Opera',isOpera:true,version:matched[1],};}
if((matched=ua.match(/SAMSUNG|Samsung|samsung/)))
{browser.isSamsung=true;}
if(ua.match(/Version\/[\d+\.]+\s*Chrome/)){browser.name='Chrome
Webview';browser.isWebview=true;}}else if(!!
ua.match(/Safari/)&&(matched=ua.match(/Android[\s\/]([\d\.]+)/)))
{browser={name:'Android',isAndroid:true,version:matched[1],};}else
if(ua.match(/iPhone|iPad|iPod/))
{if(ua.match(/Safari/)&&(matched=ua.match(/Version\/([\d\.]+)/)))
{browser={name:'Safari',isSafari:true,version:matched[1],};}else
if((matched=ua.match(/OS ([\d_\.]+) like Mac OS X/))){browser={name:'iOS
Webview',isWebview:true,version:matched[1].replace(/\_/g,'.'),};}}
if(!browser){browser={name:'unknown',version:'0.0.0',};}
return browser;}
function getOsSystem(){const ua=window.navigator.userAgent;let matched;let
os={};if((matched=ua.match(/Windows\sPhone\s(?:OS\s)?([\d\.]+)/)))
{os={name:'Windows Phone',isWindowsPhone:true,version:matched[1],};}else if(!!
ua.match(/Safari/)&&(matched=ua.match(/Android[\s\/]([\d\.]+)/)))
{os={version:matched[1],};if(ua.match(/Mobile\s+Safari/))
{os.name='Android';os.isAndroid=true;}else{os.name='AndroidPad';os.isAndroidPad=tru
e;}}else if((matched=ua.match(/(iPhone|iPad|iPod)/))){const
name=matched[1];if((matched=ua.match(/OS ([\d_\.]+) like Mac OS X/)))
{os={name,isIPhone:name==='iPhone'||
name==='iPod',isIPad:name==='iPad',isIOS:true,version:matched[1].split('_').join('.
'),};}}
if(!os){os={name:'unknown',version:'0.0.0',};}
return os;}
function getSellerKey(pathname){const splitPath=pathname.split('/');let
sellerKeyIndex=-1;if(splitPath&&pathname.indexOf('shop/')>-1)
{splitPath.forEach((sp,index)=>{if(sp==='shop'&&sellerKeyIndex===-1)
{sellerKeyIndex=index+1;return;}});return splitPath[sellerKeyIndex];}
return'notfound';}
function getQuery(key,url){url=url||window.location.search;const
hashIndex=url.indexOf('#');if(hashIndex>0){url=url.substr(0,hashIndex);}
const keyMatches=url.match(new RegExp(`[?|&]$
{encodeURIComponent(key)}=([^&]*)(&|$)`));if(keyMatches&&keyMatches[1]==='%s')
{return keyMatches[1];}
return keyMatches?decodeURIComponent(keyMatches[1]):'';}
function getSearchKeyword(lpUrl){return getQuery('q',lpUrl)||'notfound';}
function getEXLazData(){return getCookie('exlaz');}
function getCampaignQuery(lpUrl){let lpUrlFormat=new URL(lpUrl);const
host=lpUrlFormat.host;const subDomain=host.split('.')[0];const
pathName=lpUrlFormat.pathname+lpUrlFormat.search;if(subDomain&&pathName)
{return{pathName,subDomain,};}
return{pathName:'notfound',subDomain:'notfound',};}
function formatOptions(type,region,lpUrl){let lpUrlFormat=new
URL(lpUrl);let options={};options.venture=region.toLowerCase();if(type==='shop')
{options.sellerKey=getSellerKey(lpUrlFormat.pathname);}else if(type==='pdp'){let
result=lpUrl.match(/i([0-9]+)\-/);if(result&&result.length==2)
{options.itemId=result[1];}
result=lpUrl.match(/-s([0-9]+)/);if(result&&result.length==2)
{options.skuId=result[1];}}else if(type==='search')
{options.keyword=getSearchKeyword(lpUrl);}else if(type==='campaign')
{options=Object.assign(options,getCampaignQuery(lpUrl));}
return options;}
function formatDeeplink(type,region,lpUrl){let newDeepLink;try{const
options=formatOptions(type,region,lpUrl);if(type==='hp'){return`lazada://${region}?
dsource=sml`;}
if(!DEEP_LINK[type]){return`lazada://${region}/web?dsource=sml&url=$
{encodeURIComponent(lpUrl)}`;}
newDeepLink=DEEP_LINK[type].replace(DEEP_LINK_REG,
(matches)=>{if(matches.indexOf('venture')>-1){return options.venture;}
if(matches.indexOf('sellerKey')>-1){return options.sellerKey;}
if(matches.indexOf('skuId')>-1){return options.skuId;}
if(matches.indexOf('itemId')>-1){return options.itemId;}
if(matches.indexOf('keyword')>-1){return options.keyword;}
if(matches.indexOf('subdomain')>-1){return options.subDomain;}
if(matches.indexOf('path')>-1){return
options.pathName;}});if(newDeepLink.indexOf('?')>-1)
{newDeepLink+='&dsource=sml';}else{newDeepLink+='?dsource=sml';}
if(newDeepLink.indexOf('notfound')>-1){return`lazada://${region}?
dsource=sml`;}}catch(e){if(window.location.href.indexOf(openalert)>0){alert(e);}
newDeepLink=`lazada://${region}?dsource=sml`;}
return newDeepLink;}
function select(element){let selectedText;if(element.nodeName==='SELECT')
{element.focus();selectedText=element.value;}else if(element.nodeName==='INPUT'||
element.nodeName==='TEXTAREA'){const
isReadOnly=element.hasAttribute('readonly');if(!isReadOnly)
{element.setAttribute('readonly','');}
element.select();element.setSelectionRange(0,element.value.length);if(!
isReadOnly){element.removeAttribute('readonly');}

selectedText=element.value;}else{if(element.hasAttribute('contenteditable'))
{element.focus();}
const selection=window.getSelection();const
range=document.createRange();range.selectNodeContents(element);selection.removeAllR
anges();selection.addRange(range);selectedText=selection.toString();}
return selectedText;}
function copyCode(value){if(!value){return;}
const
el=document.createElement('textarea');el.textContent=value;el.style.position='fixed
';el.style.top='-
100px';el.style.left='0px';document.body.appendChild(el);select(el);if(document.que
ryCommandSupported('copy')){document.execCommand('copy');}
document.body.removeChild(el);}
function LazadaSmartLink(globalConfigOption){this.init=function()
{this.lpUrl=document.getElementById('lpUrlInput').value;this.fallback=document.getE
lementById('fallbackInput').value==='true'?
true:false;this.clickId=document.getElementById('clickIdInput').value;this.bm=docum
ent.getElementById('bmInput').value==='2'?'cps':'cpi';this.osSystem=getOsSystem();t
his.browser=getBrowser();this.venture=window.location.host.split('\.').pop().toLowe
rCase();this.venture=['vn','my','id','sg','ph','th'].indexOf(this.venture)<0?'sg':t
his.venture;this.pageType=getPageType(this.lpUrl);this.openType="";try{setTimeout(s
endGoldlog(LOG_ACTION_TYPE.openDeeplink,this.venture),0);this.openApp();}catch(e)
{console.log(e);if(window.location.href.indexOf(openalert)>0){alert(e);}}
if(window.location.href.indexOf(openalert)>0){alert(this.openType+"
deeplink = "+this.deepLink);}
setTimeout(()=>{if(this.isCps())
{if(this.fallback&&(this.lpUrl.startsWith('https://')||
this.lpUrl.startsWith('http://')))
{setTimeout(sendGoldlog(LOG_ACTION_TYPE.cpsFallback,this.venture),0);this.redirectL
ocation(this.lpUrl);return;}

if(this.osSystem.isAndroid&&this.browser.isChrome&&(this.lpUrl.startsWith('https://
')||this.lpUrl.startsWith('http://')))
{setTimeout(sendGoldlog(LOG_ACTION_TYPE.androidChromeFallback,this.venture),0);this
.redirectLocation(this.lpUrl);return;}}
if(window.location.href.indexOf(openalert)>0){alert("downloadApp
begin");}

setTimeout(sendGoldlog(LOG_ACTION_TYPE.openAppstore,this.venture),0);this.downloadA
pp();},1000);this.bindEvents();};this.isCps=()=>{return this.bm==='cps';}
this.isDeeplink=(lpUrl)=>{return lpUrl.startsWith("lazada://");}
this.openApp=()=>{console.log("open app");let
deepLink;if(this.isDeeplink(this.lpUrl))
{deepLink=this.lpUrl;}else{deepLink=formatDeeplink(this.pageType,this.venture,this.
lpUrl);}
if(this.isCps()){deepLink=appendExlaz(deepLink);}
this.deepLink=deepLink;const
ios9SafariFix=this.osSystem.isIPhone&&this.browser.isSafari;if(ios9SafariFix)
{this.userAnchorLink(this.deepLink);}else if(this.browser.isChrome)
{if(this.osSystem.isIPhone){this.userAnchorLink(this.deepLink);}else
if(this.browser.isSamsung&&(this.osSystem.version.indexOf('4.4')===0||
this.osSystem.version.indexOf('4.3')===0))
{this.deepLink='intent://#Intent;scheme=lazada;package=com.lazada.android;end';this
.redirectLocation(this.deepLink);}else{this.redirectLocation(this.deepLink);}}else
if(this.browser.isFirefox){if(this.osSystem.isIPhone)
{this.userAnchorLink(this.deepLink);}else{this.callInIframe(this.deepLink);}}else
if(this.browser.isOpera)
{this.callInIframe(this.deepLink);}else{this.callInIframe(this.deepLink);}};this.ca
llInIframe=(url)=>{if(!this.iframe)
{this.iframe=document.createElement('iframe');this.iframe.id=`callapp_iframe_$
{Date.now()}`;this.iframe.frameborder='0';this.iframe.style.cssText='display:none;b
order:0;width:0;height:0;';document.body.appendChild(this.iframe);}

this.openType="iframe";this.iframe.src=url;};this.redirectLocation=(url)=>{this.ope
nType="location";window.location.href=url;};this.userAnchorLink=(url,blankString)=>
{setTimeout(()=>{const
e=document.createEvent('HTMLEvents');e.initEvent('click',false,false);let
a=document.querySelector('#temp-smart-link');if(!a)
{a=document.createElement('a');a.setAttribute('href',url);a.setAttribute('id','temp
-smart-link');if(blankString){a.setAttribute('target',blankString);}
a.style.display='none';document.body.appendChild(a);}

this.openType="userAnchorLink";a.dispatchEvent(e);},200);};this.handleCopy=()=>{if(
this.isCps()){this.deepLink=appendExlaz(this.deepLink);}

copyCode(this.deepLink);};this.downloadAppIOS=()=>{this.handleCopy();this.redirectL
ocation(iosStore);}
this.downloadAppAndroid=()=>{this.handleCopy();if(this.isCps()){const
exlaz=getEXLazData();this.redirectLocation(androidStore+(exlaz?`&referrer=$
{encodeURIComponent(`exlaz=$
{exlaz}`)}`:''));}else{this.redirectLocation(androidStore+(this.clickId?
`&referrer=${encodeURIComponent(`click_id=${this.clickId}`)}`:''));}}
this.downloadApp=()=>{console.log("osSystem :
"+this.osSystem.isIOS);if(this.osSystem.isIOS)
{this.downloadAppIOS();}else{this.downloadAppAndroid();}};this.bindEvents=()=>{cons
t androidBtn=document.getElementById('google_play_button');const
iosBtn=document.getElementById('appstore_button');if(androidBtn!=null)
{androidBtn.onclick=()=>{setTimeout(sendGoldlog(LOG_ACTION_TYPE.clickAndroidBtn,thi
s.venture),0);this.openApp();setTimeout(()=>{this.downloadAppAndroid();},1000);retu
rn false;};}
if(iosBtn!=null)
{iosBtn.onclick=()=>{setTimeout(sendGoldlog(LOG_ACTION_TYPE.clickIosBtn,this.ventur
e),0);setTimeout(()=>{this.downloadAppIOS();},100);return false;};}};}
window.addEventListener('load',()=>{let smartlink=new
LazadaSmartLink({});smartlink.init();});
</script>
<style type="text/css">
body{margin:0px;}.app-wrap{background-image:url(https://laz-img-
cdn.alicdn.com/tfs/TB1Hkjsi7voK1RjSZPfXXXPKFXa-750-1334.png);background-repeat:no-
repeat;background-size:100% 100%;width:100%;height:100%;position:fixed;}.app-
wrap .btn-
wrap{position:fixed;bottom:10%;height:13vw;width:100%;display:flex;justify-
content:space-between;padding:0px 10vw;box-sizing:border-box;}.btn-wrap .btn-
item{width:36vw;height:13vw;background:transparent;border:none;}.btn-wrap .google-
pay-link{}.btn-wrap .app-store-link{}
</style>
</head>
<body>
<input type="hidden" id="lpUrlInput"
value="https://www.lazada.co.id/shop/samsung-official-store/year-end-sale.htm?
wh_weex=true&laz_trackid=2:mm_150030293_51150573_2010250563:clk5qldov1cviundc77da0"
/>
<input type="hidden" id="bmInput" value="2" />
<input type="hidden" id="clickIdInput" value="clk5qldov1cviundc77da0" />
<input type="hidden" id="fallbackInput" value="true" />
<div class="app-wrap">
<div class="btn-wrap">
<input type="button" class="google-pay-link btn-item"
id="google_play_button"/>
<input type="button" class="app-store-link btn-item"
id="appstore_button"/>
</div>
</div>
</body>
</html>