-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathold_pageview_event.sql
executable file
·66 lines (63 loc) · 5.47 KB
/
old_pageview_event.sql
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
SELECT
uuid() as `_id`,
'browser' as `DeviceType`,
`infiniti-live`.`SessionAction`.`SessionActionDate` AS `clientTimestamp`,
'pageview' as action,
null as `namespace`,
Customer.CustomerGuid as `infinitiID`,
'' as `installationID`,
`infiniti-live`.`Session`.`SessionID` AS `sessionID`,
`infiniti-live`.`Customer`.`CustomerID` AS `customerID`,
`infiniti-live`.`ChannelSource`.`ChannelSourceName` AS `referral_Channel`,
'' as `referral_url`,
`infiniti-live`.`BD_CustomerCluster`.`clusters` as `clusters`,
`infiniti-live`.`BD_CustomerTopConfidentLanguage`.`LanguageCode` as `language`,
'' as `geolocation_locationName`,
`infiniti-live`.`BD_IPAddressWithCountryAndCity`.`IPAddressValue` AS `geolocation_ip`,
`infiniti-live`.`BD_IPAddressWithCountryAndCity`.`IPAddressLat` AS `geolocation_latitude`,
`infiniti-live`.`BD_IPAddressWithCountryAndCity`.`IPAddressLong` AS `geolocation_longitude`,
`infiniti-live`.`BD_IPAddressWithCountryAndCity`.`City` AS `geolocation_city`,
`infiniti-live`.`BD_IPAddressWithCountryAndCity`.`IPAddressRegion` AS `geolocation_region`,
`infiniti-live`.`BD_IPAddressWithCountryAndCity`.`Country` AS `geolocation_country`,
`infiniti-live`.`BD_IPAddressWithCountryAndCity`.`CountryCode2` AS `geolocation_countryCode`,
`infiniti-live`.`CustomerDevice`.`USerAgent` AS `environment_userAgent`,
`infiniti-live`.`CustomerDevice`.`JavascriptEnabled` AS `environment_javascript`,
`infiniti-live`.`CustomerDevice`.`CookiesEnabled` AS `environment_cookies`,
`infiniti-live`.`CustomerDevice`.`DeviceBrowser` AS `environment_browser_name`,
`infiniti-live`.`CustomerDevice`.`BrowserVersion` AS `environment_browser_version`,
`infiniti-live`.`CustomerDevice`.`OS` AS `environment_os`,
`infiniti-live`.`BD_CustomerCluster`.`Clusters` AS `user_clusters`,
`infiniti-live`.`BD_CustomerTopConfidentLanguage`.`LanguageCode` AS `user_language`,
`infiniti-live`.`BD_CustomerTopConfidentBirthDate`.`CustomerBirthDate` AS `user_birthdate`,
`ESPreparedCustomerTopConfidentGender`.`GenderName` AS `user_gender`,
'' as `user_address_latitutde`,
'' as `user_address_longitude`,
`ESPreparedCustomerTopConfidentCountry`.`CityName` AS `user_address_city`,
'' as `user_address_region`,
`ESPreparedCustomerTopConfidentCountry`.`CountryCode` AS `user_address_country_code`,
'' as `user_interests`,
'' as `user_channel`,
`infiniti-live`.`BD_SocialAccountMembership`.`Facebook` AS `user.socialNetworks.facebook`,
`infiniti-live`.`BD_SocialAccountMembership`.`LinkedIn` AS `user.socialNetworks.linkedin`,
`infiniti-live`.`BD_SocialAccountMembership`.`GooglePlus` AS `user.socialNetworks.google`,
`infiniti-live`.`SessionAction`.`ActionURL` AS `actionUrl`,
`infiniti-live`.`CustomerDevice`.`DeviceType` AS `DeviceType`
FROM
((((((((((((((
`infiniti-live`.`SessionAction`
JOIN `infiniti-live`.`Action` ON ((`infiniti-live`.`SessionAction`.`ActionID` = `infiniti-live`.`Action`.`ActionID`)))
JOIN `infiniti-live`.`Session` ON ((`infiniti-live`.`Session`.`SessionID` = `infiniti-live`.`SessionAction`.`SessionID`)))
JOIN `infiniti-live`.`Customer` ON ((`infiniti-live`.`Session`.`CustomerID` = `infiniti-live`.`Customer`.`CustomerID`)))
LEFT JOIN `infiniti-live`.`BD_SocialAccountMembership` ON ((`infiniti-live`.`Customer`.`CustomerID` = `infiniti-live`.`BD_SocialAccountMembership`.`CustomerID`)))
LEFT JOIN `infiniti-live`.`BD_CustomerTopConfidentBirthDate` ON ((`infiniti-live`.`Customer`.`CustomerID` = `infiniti-live`.`BD_CustomerTopConfidentBirthDate`.`CustomerID`)))
LEFT JOIN `infiniti-live`.`BD_CustomerTopConfidentLanguage` ON ((`infiniti-live`.`Customer`.`CustomerID` = `infiniti-live`.`BD_CustomerTopConfidentLanguage`.`CustomerID`)))
LEFT JOIN `infiniti-live`.`BD_CustomerCluster` ON ((`infiniti-live`.`Customer`.`CustomerID` = `infiniti-live`.`BD_CustomerCluster`.`CustomerID`)))
LEFT JOIN `infiniti-live`.`BD_IPAddressWithCountryAndCity` ON ((`infiniti-live`.`Session`.`IPAddressID` = `infiniti-live`.`BD_IPAddressWithCountryAndCity`.`IPAddressID`)))
LEFT JOIN `infiniti-live`.`ESPreparedCustomerTopConfidentGender` ON ((`infiniti-live`.`Customer`.`CustomerID` = `ESPreparedCustomerTopConfidentGender`.`CustomerID`)))
LEFT JOIN `infiniti-live`.`ESPreparedCustomerTopConfidentCountry` ON ((`ESPreparedCustomerTopConfidentCountry`.`CustomerID` = `infiniti-live`.`Customer`.`CustomerID`)))
LEFT JOIN `infiniti-live`.`ESPreparedTransactions` ON ((`ESPreparedTransactions`.`SessionID` = `infiniti-live`.`Session`.`SessionID`)))
JOIN `infiniti-live`.`ESPreparedEntryPoints` ON ((`ESPreparedEntryPoints`.`SessionID` = `infiniti-live`.`Session`.`SessionID`)))
JOIN `infiniti-live`.`ChannelSource` ON ((`infiniti-live`.`Session`.`ChannelSourceID` = `infiniti-live`.`ChannelSource`.`ChannelSourceID`)))
LEFT JOIN `infiniti-live`.`CustomerDevice` ON (((`infiniti-live`.`Session`.`CustomerDeviceID` = `infiniti-live`.`CustomerDevice`.`CustomerDeviceID`)
AND (`infiniti-live`.`SessionAction`.`ActionID` = `infiniti-live`.`Action`.`ActionID`))))
where `infiniti-live`.`Customer`.`CustomerID` between user1 and user2