Skip to content

Commit be46e63

Browse files
author
vikasrohit
authored
Merge pull request #1270 from appirio-tech/feature/add-google-analytics-fields-lead
Github issue#1227, Google Analytics ID + Click ID integration for marketing
2 parents b180d93 + 60713fe commit be46e63

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

npm-shrinkwrap.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"history": "^1.17.0",
5555
"html5-uploader": "^0.1.1",
5656
"isomorphic-fetch": "^2.2.1",
57+
"js-cookie": "^2.1.4",
5758
"linkify-it": "^2.0.3",
5859
"lodash": "^4.16.4",
5960
"moment": "^2.14.1",

src/config/constants.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,4 +260,8 @@ export const LS_INCOMPLETE_PROJECT = 'incompleteProject'
260260

261261
export const CONNECT_MESSAGE_API_URL = process.env.CONNECT_MESSAGE_API_URL || TC_API_URL
262262

263-
export const NEW_PROJECT_PATH = '/new-project'
263+
export const NEW_PROJECT_PATH = '/new-project'
264+
265+
// Analytics constants
266+
export const GA_CLICK_ID = '_gclid'
267+
export const GA_CLIENT_ID = '_gacid'

src/projects/create/containers/CreateContainer.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import _ from 'lodash'
2+
import Cookies from 'js-cookie'
23
import React, { PropTypes } from 'react'
34
import { withRouter, browserHistory } from 'react-router'
45
import { connect } from 'react-redux'
@@ -13,7 +14,9 @@ import {
1314
LS_INCOMPLETE_PROJECT,
1415
PROJECT_STATUS_IN_REVIEW,
1516
ACCOUNTS_APP_REGISTER_URL,
16-
NEW_PROJECT_PATH
17+
NEW_PROJECT_PATH,
18+
GA_CLIENT_ID,
19+
GA_CLICK_ID
1720
} from '../../../config/constants'
1821

1922
const page404 = compose(
@@ -131,6 +134,14 @@ class CreateConainer extends React.Component {
131134
// if user is logged in and has a valid role, create project
132135
// uses dirtyProject from the state as it has the latest changes from the user
133136
// this.props.createProjectAction(project)
137+
const gaClickId = Cookies.get(GA_CLICK_ID)
138+
const gaClientId = Cookies.get(GA_CLIENT_ID)
139+
if(gaClientId || gaClickId) {
140+
const googleAnalytics = {}
141+
googleAnalytics[GA_CLICK_ID] = gaClickId
142+
googleAnalytics[GA_CLIENT_ID] = gaClientId
143+
_.set(project, 'details.utm.google', googleAnalytics)
144+
}
134145
this.props.createProjectAction(project, PROJECT_STATUS_IN_REVIEW)
135146
} else {
136147
// redirect to registration/login page

0 commit comments

Comments
 (0)