-
Notifications
You must be signed in to change notification settings - Fork 10
/
Application.cfc
executable file
·48 lines (38 loc) · 1.29 KB
/
Application.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<cfcomponent output="false">
<!--- Application settings --->
<cfset this.name = "google_analytics_api" />
<cfset this.sessionManagement = true />
<cfset this.sessionTimeout = createTimeSpan(0,2,30,0) />
<cffunction name="onApplicationStart"
access="public"
returntype="boolean"
output="false"
hint="Fires when the application is first created.">
<cfset application.objGA = new com.coldfumonkeh.GoogleAnalytics(
client_id = '< your client id >',
client_secret = '< your client secret >',
redirect_uri = 'http://127.0.0.1:8500/googleanalytics/index.cfm',
readonly = false,
state = '',
access_type = 'offline',
approval_prompt = 'force'
) />
<cfset application.objGA.setAccess_token('< your access token >') />
<cfset application.objGA.setRefresh_token('< your refresh token >') />
<cfreturn true />
</cffunction>
<cffunction
name="onRequestStart"
access="public"
returntype="boolean"
output="false"
hint="Fires at first part of page processing.">
<cfif structKeyExists(URL, 'reinit')>
<cfif structKeyExists(session, "google_api_auth")>
<cfset structDelete(session,"google_api_auth")>
</cfif>
<cfset onApplicationStart() />
</cfif>
<cfreturn true />
</cffunction>
</cfcomponent>