Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 1x | import { isPlatformBrowser } from '@angular/common';
import { Component, OnInit, PLATFORM_ID, inject } from '@angular/core';
import { ActivatedRoute, RouterOutlet } from '@angular/router';
import { CookiesElementComponent } from '@elements/cookies-element/cookies-element.component';
import { AuthService } from '@services/auth.service';
import { SeoService } from '@services/seo.service';
import { UTMTrackerService } from '@services/utm-tracker.service';
import { CookieService } from 'ngx-cookie-service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
imports: [RouterOutlet, CookiesElementComponent],
})
export class AppComponent implements OnInit {
private cookieService = inject(CookieService);
private platformId = inject(PLATFORM_ID);
private seoService = inject(SeoService);
private utmTracker = inject(UTMTrackerService);
private authService = inject(AuthService);
route = inject(ActivatedRoute);
title = 'GoRealEurope';
cookieValue = 'UNKNOWN';
gre_ta!: string | any;
cjevent!: string | any;
utm_medium!: string;
utm_email!: string;
utm_source!: string;
utm_campaign!: string;
utm_term!: string;
utm_content!: string;
lead_form_type!: string;
page_url!: string;
marketing_trip_name!: string;
showCookieBar = false;
isBrowser: boolean;
constructor() {
this.isBrowser = isPlatformBrowser(this.platformId);
}
onActivate() {
if (isPlatformBrowser(this.platformId)) {
window.scroll(0, 0);
}
}
onCookieBarClose(shouldHide: boolean) {
if (shouldHide && this.isBrowser) {
window.localStorage.setItem('cookie_bar', 'done');
this.showCookieBar = false;
}
}
ngOnInit(): void {
this.authService.verifySession().subscribe({
next: (user) => {
if (user) {
console.log('Session restored from cookies:', user);
}
},
error: (error) => {
console.log('No active session', error);
},
});
// objectFitImages();
setTimeout(() => {
if (isPlatformBrowser(this.platformId)) {
const head = document.getElementsByTagName('head')[0];
const script = document.createElement('script');
script.type = 'text/javascript';
script.src = '//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js';
script.defer = true;
head.appendChild(script);
}
}, 1000);
if (this.isBrowser) {
this.showCookieBar = localStorage.getItem('cookie_bar') !== 'done';
}
this.utmTracker.initOnFirstPage();
//this.cookieService.deleteAll();
this.route.queryParams.subscribe((params) => {
this.cjevent = params['cjevent'];
this.gre_ta = params['gre_ta'];
this.utm_medium = params['utm_medium'];
this.utm_email = params['utm_email'];
if (Array.isArray(params['utm_source'])) {
this.utm_source = params['utm_source'][0];
} else {
this.utm_source = params['utm_source'];
}
this.utm_campaign = params['utm_campaign'];
this.utm_term = params['utm_term'];
this.utm_content = params['utm_content'];
this.lead_form_type = params['lead_form_type'];
this.page_url = params['page_url'];
this.marketing_trip_name = params['marketing_trip_name'];
if (this.cjevent !== undefined && this.gre_ta !== undefined) {
this.cookieService.delete('_gre_ta', '/');
this.cookieService.delete('_cjevent', '/');
this.cookieService.delete('_utm_medium', '/');
this.cookieService.delete('_utm_email', '/');
this.cookieService.delete('_utm_source', '/');
this.cookieService.delete('_utm_campaign', '/');
this.cookieService.delete('_utm_term', '/');
this.cookieService.delete('_utm_content', '/');
this.cookieService.delete('_utm_params', '/');
this.cookieService.set('_cjevent', this.cjevent, 120, '/');
this.cookieService.set('_gre_ta', this.gre_ta, 120, '/');
} else if (this.cjevent !== undefined && this.gre_ta == undefined) {
this.cookieService.delete('_gre_ta', '/');
this.cookieService.delete('_cjevent', '/');
this.cookieService.delete('_utm_medium', '/');
this.cookieService.delete('_utm_email', '/');
this.cookieService.delete('_utm_source', '/');
this.cookieService.delete('_utm_campaign', '/');
this.cookieService.delete('_utm_term', '/');
this.cookieService.delete('_utm_content', '/');
this.cookieService.delete('_utm_params', '/');
this.cookieService.set('_cjevent', this.cjevent, 120, '/');
} else if (this.cjevent == undefined && this.gre_ta !== undefined) {
this.cookieService.delete('_gre_ta', '/');
this.cookieService.delete('_cjevent', '/');
this.cookieService.delete('_utm_medium', '/');
this.cookieService.delete('_utm_email', '/');
this.cookieService.delete('_utm_source', '/');
this.cookieService.delete('_utm_campaign', '/');
this.cookieService.delete('_utm_term', '/');
this.cookieService.delete('_utm_content', '/');
this.cookieService.delete('_utm_params', '/');
this.cookieService.set('_gre_ta', this.gre_ta, 120, '/');
} else if (
this.utm_medium !== undefined ||
this.utm_email !== undefined ||
this.utm_source !== undefined ||
this.utm_campaign !== undefined ||
this.utm_term !== undefined ||
this.utm_content !== undefined
) {
this.cookieService.delete('_gre_ta', '/');
this.cookieService.delete('_cjevent', '/');
this.cookieService.delete('_utm_medium', '/');
this.cookieService.delete('_utm_email', '/');
this.cookieService.delete('_utm_source', '/');
this.cookieService.delete('_utm_campaign', '/');
this.cookieService.delete('_utm_term', '/');
this.cookieService.delete('_utm_content', '/');
this.cookieService.delete('_utm_params', '/');
const source: any = {};
if (this.utm_medium !== undefined) {
source['utm_medium'] = this.utm_medium;
this.cookieService.set('_utm_medium', this.utm_medium, 120, '/');
}
if (this.utm_email !== undefined) {
source['utm_email'] = this.utm_email;
this.cookieService.set('_utm_email', this.utm_email, 120, '/');
}
if (this.utm_source !== undefined) {
source['utm_source'] = this.utm_source;
this.cookieService.set('_utm_source', this.utm_source, 120, '/');
}
if (this.utm_campaign !== undefined) {
source['utm_campaign'] = this.utm_campaign;
this.cookieService.set('_utm_campaign', this.utm_campaign, 120, '/');
}
if (this.utm_term !== undefined) {
source['utm_term'] = this.utm_term;
this.cookieService.set('_utm_term', this.utm_term, 120, '/');
}
if (this.utm_content !== undefined) {
source['utm_content'] = this.utm_content;
this.cookieService.set('_utm_content', this.utm_content, 120, '/');
}
if (this.lead_form_type !== undefined) {
source['lead_form_type'] = this.lead_form_type;
this.cookieService.set('lead_form_type', this.lead_form_type, 120, '/');
}
if (this.page_url !== undefined) {
source['page_url'] = this.page_url;
this.cookieService.set('page_url', this.page_url, 120, '/');
}
if (this.marketing_trip_name !== undefined) {
source['marketing_trip_name'] = this.marketing_trip_name;
this.cookieService.set('marketing_trip_name', this.marketing_trip_name, 120, '/');
}
this.cookieService.set('_utm_params', JSON.stringify(source), 120, '/');
}
});
}
}
|