Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
shuaiguo
5 years ago
Commit
9249e0f6970ef3d42f3c4e0c39b4fafc28cbc584
2 parents
04f785c9
a0c9654c
master
...
develop
feature/company-profile
feature/home-optimize
feature/payment
feature/reduce
hotfix/cart
hotfix/ocpc
hotfix/shop
hotfix/upload
all
Merge remote-tracking branch 'refs/remotes/origin/baidu_ocpcapi'
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
0 deletions
apps/passport/models/login-service.js
public/js/common.js
apps/passport/models/login-service.js
View file @
9249e0f
'use strict'
;
const
request
=
require
(
'request-promise'
);
const
md5
=
require
(
'md5'
);
const
uuid
=
require
(
'uuid'
);
const
_
=
require
(
'lodash'
);
...
...
@@ -20,6 +21,34 @@ const UserService = require('./user-service');
const
LoginApi
=
require
(
'./login-api'
);
const
logger
=
global
.
yoho
.
logger
;
class
BaiduSDK
{
/*
* @ description: 广告主回传转化数据接口, 上报百度
* @ author: huzhiming
* @ date: 2019-11-19 17:21:29
* @ version: v1.0.0
* 详情见文档:[http://ocpc.baidu.com/developer/d/guide/?iurl=api%2Fapi-doc%2Fapi-interface%2F]
*/
static
reportOcpcApi
({
token
=
'7GULUkX90QLZU6cHO9OEqUsRKttGNqpN@O62eFfb91OUVhmkakV1bQHIxF8xURBvP'
,
conversionTypes
=
[{
logidUrl
:
''
,
newType
:
null
}]
})
{
request
({
method
:
'POST'
,
uri
:
'http://ocpc.baidu.com/ocpcapi/api/uploadConvertData'
,
body
:
{
token
,
conversionTypes
},
json
:
true
}).
then
((
result
)
=>
{
console
.
log
(
`
[
账号注册成功后上报
百度
ocpc
返回信息:
$
{
JSON
.
stringify
(
result
)}
`
);
}).
catch
((
error
)
=>
{
console
.
log
(
`
[
账号注册成功后上报
百度
ocpc
失败
错误信息:
$
{
error
}
`
);
});
}
}
module
.
exports
=
class
extends
global
.
yoho
.
BaseModel
{
constructor
(
ctx
)
{
super
(
ctx
);
...
...
@@ -125,6 +154,23 @@ module.exports = class extends global.yoho.BaseModel {
domain
:
config
.
cookieDomain
});
/*
* @ description: feat(oCPC搜索推广): 推广链接转化数据发送给百度服务器,埋点:OCPC推广链接打开并完成注册进行数据上报
* @ author: huzhiming
* @ date: 2019-11-19 19:09:39
* @ version: v1.0.0
* bd_vid_path存值见:public/js/common.js 文件
*/
const
logidUrl
=
req
.
cookies
.
bd_vid_path
;
if
(
logidUrl
)
{
BaiduSDK
.
reportOcpcApi
({
conversionTypes
:
{
logidUrl
,
newType
:
25
}
});
}
req
.
session
.
TOKEN_
=
publicToken
;
req
.
session
.
LOGIN_UID_
=
uid
;
...
...
public/js/common.js
View file @
9249e0f
...
...
@@ -130,6 +130,17 @@ function getShoppingKey() {
if
(
window
.
_yas
)
{
window
.
_yas
(
1
*
new
Date
(),
window
.
_yasVersion
,
'yohobuy_web'
,
uid
,
''
,
''
);
}
/* 【加入ocpcApi代码】: 判断当前页面地址若百度sem推广链接,即将推广链接存到cookies,支付成功后将推广链接上报百度 ocpcapi
* @ description: 收集百度sem推广链接
* @ author: huzhiming
* @ date: 2019-11-18 16:55:17
* @ version: v1.0.0
* 详情见文档:[http://ocpc.baidu.com/developer/d/guide/?iurl=api%2Fapi-doc%2Fapi-interface%2F]
*/
if
(
location
.
href
.
includes
(
'bd_vid='
))
{
setCookie
(
'bd_vid_path'
,
location
.
href
,
{
path
:
'/'
,
domain
:
'.yohobuy.com'
,
expires
:
90
});
}
}());
// window.resize在width<1180时适配成990
...
...
Please
register
or
login
to post a comment