Posts tagged with angular

I have an Angular SPA web application, register my site to Adsense they approved in 1 day later I inject the codes for showing ads. And other day ads started to shown. 1 hour later I started to see little income. But then income stopped but ads still in my site. Reports on Adsense counts the view but there is no income. Its like this last 3 weeks.

Is there anyone have experience with Adsense and Angular, because I feel like Adsense doesn't work with angular.

I have added google adwords conversion code to the head of my index.html:

<!-- Global site tag (gtag.js) - Google Ads: 0000000--> <script async src="https://www.googletagmanager.com/gtag/js?id=AW-0000000"></script> <script>window.dataLayer = window.dataLayer || [];   function gtag(){dataLayer.push(arguments);}   gtag('js', new Date());   gtag('config', 'AW-0000000');</script> <!-- Event snippet for 0000000 conversion page In your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. --> <script>function gtag_report_conversion(url) {     var callback = function () {       if (typeof(url) != 'undefined') {         window.location = url;       }     };     gtag('event', 'conversion', {         'send_to': 'AW-0000000/0000000-0000000',         'event_callback': callback     });     return false;   }</script> 

The conversion should be counted when a user successfully registers. For this I need to wait for the success message in my register user api endpoint, which is called in a component:

this.http.post<any>(apiEndpoint, sendData).subscribe(data => {   console.log(data);   if (data['error']) {     this.regError = data['errortxt'];   } else {     this.regError = "";     this.dataService.REG_AUTH = data['data']['token'];     localStorage.setItem('regauth', data['data']['token']);     // Adwords Conversion     gtag_report_conversion(url);     this.navigation.loadView(this.navigation.getView('3').name);   } }, error => {   console.log(error.json()); }); 

It tells me Cannot find name gtag_report_conversion(url);

Any ideas? Somehow I need to import the function from index.html?