Commit 703118b9 by xuzhenghua

tongji

parent 9e5d2f7f
var API = {
'www': 'http://www-test.julyedu.com',
'home': 'http://fast-test.julyedu.com',
'search-api': 'https://search.julyedu.com',
'passport-api': 'http://passport-test.julyedu.com',
......
import React, { Component } from 'react'
import React, {Component} from 'react'
import Routes from './router'
import cookie from 'js-cookie'
import { connect } from "react-redux";
import { setCurrentUser, startFetchUser } from "@/store/userAction";
import { withRouter } from 'react-router-dom'
import { compose } from 'redux'
import { getParam, http, browser } from "@/utils";
import { Toast } from "antd-mobile";
import { addDays } from 'date-fns'
import {connect} from "react-redux";
import {setCurrentUser, startFetchUser} from "@/store/userAction";
import {withRouter} from 'react-router-dom'
import {compose} from 'redux'
import {getParam, http, browser} from "@/utils";
import {Toast} from "antd-mobile";
import {addDays} from 'date-fns'
//拦截ajax请求,返回mock数据
......@@ -88,6 +88,32 @@ class App extends Component {
}
}
utm = () => {
// utm统计 m站全站统计广告投放、以及统计详情页浏览
let utm_source = getParam('utm_source')
let utm_medium = getParam('utm_medium')
let utm_campaign = getParam('utm_campaign')
let utm_content = getParam('utm_content')
let utm_term = getParam('utm_term')
let courseId = location.pathname.startsWith('/getDetail') || location.pathname.startsWith('/detail') ? getParam('id') : 0
if (courseId || (utm_term && utm_source && utm_medium && utm_campaign && utm_content)) {
let data = {
'utm_source': utm_source,
'utm_medium': utm_medium,
'utm_campaign': utm_campaign,
'utm_content': utm_content,
'utm_term': utm_term,
}
http.post(`${API['www']}/base/first_utm_record/${courseId}`, data)
.then(res => {
})
}
}
getUser = () => {
this.props.startFetchUser()
......@@ -124,6 +150,7 @@ class App extends Component {
}
componentDidUpdate() {
this.utm()
const {location} = this.props
this.previousLocation = location.pathname.startsWith('/passport') ?
this.previousLocation.pathname === '/' ? location : this.previousLocation : location
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment