Skip to content

Commit

Permalink
Added google analytics tag (#964)
Browse files Browse the repository at this point in the history
* Added google analytics tag

* Fixed googletagmanager link
  • Loading branch information
norberttech authored Feb 4, 2024
1 parent ae0e0b9 commit 81093a6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/publish-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
env:
DOMAIN: flow-php.com
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GOOGLE_ANALYTICS_ID: 'G-1W17JSMLE5'
working-directory: "web/landing"

- name: Pushes build to website repository
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@ jobs:

- name: "Test"
run: "composer test"
working-directory: "web/landing"

- name: "Test Build"
run: "composer build"
working-directory: "web/landing"
1 change: 1 addition & 0 deletions web/landing/.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ APP_ENV=dev
APP_SECRET=04f48bdb7d5426b4c5ba6aaf3d00a1fa
DOMAIN='flow-php.wip'
GITHUB_TOKEN=changeme
GOOGLE_ANALYTICS_ID=G-XXXXXXXXXX
4 changes: 3 additions & 1 deletion web/landing/config/packages/twig.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
twig:
default_path: '%kernel.project_dir%/templates'

globals:
google_analytics_id: '%env(GOOGLE_ANALYTICS_ID)%'

when@test:
twig:
strict_variables: true
8 changes: 8 additions & 0 deletions web/landing/templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
{{ importmap() }}
{% endblock %}
</head>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ google_analytics_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ google_analytics_id }}');
</script>
<body class="scroll-smooth bg-black text-white">
<header class="py-2 text-white bg-blue-200">
<div class="mx-auto max-w-screen-xl px-4 flex items-center justify-between ">
Expand Down

0 comments on commit 81093a6

Please sign in to comment.