forked from nextcloud/ios
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NMC 1998 Tracking tealium adjust setup
- Loading branch information
1 parent
7a4bb44
commit f59ae0c
Showing
9 changed files
with
1,266 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// AdjustHelper.h | ||
// Nextcloud | ||
// | ||
// Created by A200073704 on 17/05/23. | ||
// Copyright © 2023 Marino Faggiana. All rights reserved. | ||
// | ||
#import <Foundation/Foundation.h> | ||
#import <Adjust.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
typedef enum : NSUInteger { | ||
Login, | ||
LoginSuccessful, | ||
Sharing, | ||
CreateLink, | ||
DocumentScan, | ||
CameraUpload, | ||
FileUpload, | ||
UseCamera, | ||
Logout, | ||
ResetsApp, | ||
AutomaticUploadPhotosOn, | ||
AutomaticUploadPhotosOff, | ||
ManualBackup, | ||
AutomaticBackup | ||
} TriggerEvent; | ||
|
||
@interface AdjustHelper : NSObject | ||
|
||
@property (nonatomic, strong) NSString *yourAppToken; | ||
@property (nonatomic, strong) NSString *environment; | ||
@property (nonatomic, strong) ADJConfig *adjustConfig; | ||
@property (nonatomic, strong) ADJEvent *eventLogin; | ||
@property (nonatomic, strong) ADJEvent *event; | ||
@property (nonatomic, assign) TriggerEvent triggerEvent; | ||
|
||
-(void)configAdjust; | ||
-(void)subsessionEnd; | ||
-(void)subsessionStart; | ||
-(void)trackLogin; | ||
-(void)trackEvent:(TriggerEvent)event; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
// | ||
// AdjustHelper.m | ||
// Nextcloud | ||
// | ||
// Created by A200073704 on 17/05/23. | ||
// Copyright © 2023 Marino Faggiana. All rights reserved. | ||
// | ||
|
||
#import "AdjustHelper.h" | ||
//#import <AdjustSdk/AdjustSdk.h> | ||
|
||
@implementation AdjustHelper | ||
|
||
-(void)configAdjust { | ||
self.yourAppToken = @"1zfaxn19pd7k"; | ||
self.environment = ADJEnvironmentProduction; | ||
self.adjustConfig = [ADJConfig configWithAppToken:self.yourAppToken | ||
environment:self.environment]; | ||
[self.adjustConfig setLogLevel:ADJLogLevelVerbose]; | ||
[Adjust appDidLaunch:self.adjustConfig]; | ||
} | ||
|
||
-(void)subsessionEnd { | ||
[Adjust trackSubsessionEnd]; | ||
} | ||
|
||
-(void)subsessionStart { | ||
[Adjust trackSubsessionStart]; | ||
} | ||
|
||
- (void)trackLogin { | ||
self.eventLogin = [ADJEvent eventWithEventToken:@"p8hl78"]; | ||
[Adjust trackEvent: self.eventLogin]; | ||
} | ||
|
||
-(void)trackEvent:(TriggerEvent)event { | ||
// self.event = [ADJEvent eventWithEventToken:@"gb97gb"]; | ||
BOOL track = [[NSUserDefaults standardUserDefaults] valueForKey:@"isAnalysisDataCollectionSwitchOn"]; | ||
if (!track) { | ||
return; | ||
} | ||
|
||
switch(event){ | ||
case Login: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"p8hl78"]; | ||
// event = [ADJEvent eventWithEventToken:@"gb97gb"]; | ||
// self.event = [ADJEvent eventWithEventToken:@"gb97gb"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
break; | ||
case LoginSuccessful: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"dowf81"]; | ||
// event = [ADJEvent eventWithEventToken:@"gb97gb"]; | ||
// self.event = [ADJEvent eventWithEventToken:@"gb97gb"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
break; | ||
case Sharing: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"mbeoyd"]; | ||
[Adjust trackEvent:event]; | ||
NSLog(@"%@", [event debugDescription]); | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"fqtiu7"]; | ||
break; | ||
case CreateLink: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"29b333"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"qeyql3"]; | ||
break; | ||
case DocumentScan: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"im963g"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"7fec8n"]; | ||
break; | ||
case CameraUpload: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"hf9paq"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"v1g6ly"]; | ||
break; | ||
case FileUpload: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"hsbk2m"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"4rd8r4"]; | ||
break; | ||
case UseCamera: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"3czack"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"3czack"]; | ||
break; | ||
case Logout: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"n5q2qu"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"g6mj9y"]; | ||
break; | ||
case ResetsApp: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"3sj1xp"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"zi18r0"]; | ||
break; | ||
case AutomaticUploadPhotosOn: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"5lxz6h"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"vwd9yk"]; | ||
break; | ||
case AutomaticUploadPhotosOff: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"176496"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"e95w5t"]; | ||
break; | ||
case ManualBackup: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"oojr4y"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"oojr4y"]; | ||
break; | ||
case AutomaticBackup: | ||
{ | ||
ADJEvent *event = [ADJEvent eventWithEventToken:@"7dkhkx"]; | ||
[Adjust trackEvent:event]; | ||
} | ||
// self.event = [ADJEvent eventWithEventToken:@"7dkhkx"]; | ||
break; | ||
|
||
default : | ||
break; | ||
} | ||
// [Adjust trackEvent: self.event]; | ||
} | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// TealiumHelper.swift | ||
// Nextcloud | ||
// | ||
// Created by A200073704 on 17/05/23. | ||
// Copyright © 2023 Marino Faggiana. All rights reserved. | ||
// | ||
import TealiumCore | ||
import TealiumLifecycle | ||
import TealiumAutotracking | ||
import TealiumLocation | ||
import TealiumRemoteCommands | ||
import TealiumTagManagement | ||
import TealiumVisitorService | ||
import Foundation | ||
|
||
class TealiumHelper: NSObject { | ||
static let shared = TealiumHelper() | ||
let config = TealiumConfig(account: "telekom", | ||
profile: "magentacloud-app", | ||
environment: "dev") | ||
var tealium: Tealium? | ||
|
||
@objc override init() { | ||
|
||
config.batchingEnabled = true | ||
config.logLevel = .debug | ||
|
||
config.collectors = [Collectors.Lifecycle, | ||
Collectors.Location, | ||
Collectors.VisitorService] | ||
|
||
config.dispatchers = [Dispatchers.TagManagement, | ||
Dispatchers.RemoteCommands] | ||
|
||
tealium = Tealium(config: config, enableCompletion: {value in | ||
print(value) | ||
} | ||
) | ||
} | ||
|
||
func start() { | ||
_ = TealiumHelper.shared | ||
} | ||
|
||
@objc func trackView(title: String, data: [String: Any]?) { | ||
let tealView = TealiumView(title, dataLayer: data) | ||
TealiumHelper.shared.tealium?.track(tealView) | ||
} | ||
|
||
@objc func trackEvent(title: String, data: [String: Any]?) { | ||
let tealEvent = TealiumEvent(title, dataLayer: data) | ||
TealiumHelper.shared.tealium?.track(tealEvent) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.