Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
add google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
immadisairaj committed Jun 10, 2020
1 parent 7fcd3a8 commit 51f4e0b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/view/home/home.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:responsive_builder/responsive_builder.dart';
import 'dart:js' as js;

import 'package:website/view/home/home_desktop.dart';
import 'package:website/view/home/home_mobile.dart';
Expand All @@ -11,6 +12,7 @@ class Home extends StatelessWidget {

@override
Widget build(BuildContext context) {
js.context.callMethod('sendNavigation', [route]);
return ScreenTypeLayout(
mobile: HomeMobile(),
desktop: HomeDesktop(),
Expand Down
2 changes: 2 additions & 0 deletions lib/view/profile/profile.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:responsive_builder/responsive_builder.dart';
import 'dart:js' as js;

import 'package:website/view/profile/profile_desktop.dart';
import 'package:website/view/profile/profile_mobile.dart';
Expand All @@ -11,6 +12,7 @@ class Profile extends StatelessWidget {

@override
Widget build(BuildContext context) {
js.context.callMethod('sendNavigation', [route]);
return ScreenTypeLayout(
mobile: ProfileMobile(),
desktop: ProfileDesktop(),
Expand Down
3 changes: 3 additions & 0 deletions web/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function sendNavigation(location) {
ga('send', 'pageview', location);
}
15 changes: 14 additions & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,21 @@
<link rel="shortcut icon" type="image/png" href="logo.png"/>
<!-- Replace Favicon with Custom logo -->

<title>website</title>
<!-- The Following is for Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

// Replace UA-XXXXXXXXX-X with Google Analytics ID
ga('create', 'UA-168944360-2', 'auto');
ga('send', 'pageview');
</script>

<title>Sai Rajendra Immadi</title>
<link rel="manifest" href="manifest.json">
<script src="app.js" defer></script>
</head>
<body id="app-container">
<!-- This script installs service_worker.js to provide PWA functionality to
Expand Down

0 comments on commit 51f4e0b

Please sign in to comment.