LMAP .htaccess rewrite rules with google analytics - Help needed
-
I am trying to build a rewrite rule that will report how many visits to sub.domain.com occur.
I dont care If I use google analytics, mautic, or any other of the apps available.
I just need to know how many visits this subdomain is getting to track attention and clickthrough.
How can I achieve this?
-
So with GA, I created the data stream and added the TAG as directed after th head tag on the default index.php file that comes with the LAMP app install.
It isnt detecting traffic, Ill check back on this in 48 hours but even google is saying that it isnt detecting the GA tag.
-
If you're actually using .php pages w/o HTML, see https://stackoverflow.com/questions/15201082/where-to-add-google-analytics-code-to-a-php-website
There is no delay, it should either work or not from the GA console.
-
Ok, then something I am doing is wrong. And I don't know what.
/app/data/public/ .htaccess contains this
# Permanent URL redirect RewriteEngine on Redirect 302 / https://discord.gg/bGH$$$$$$$
/app/data/public/ index.php contains this
<html> <head> <title> Cloudron LAMP app (PHP 7.4)</title> </head> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-H65R5$%#%@"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-H65R@#$$%#'); </script> <body> </body> </html> `
-
I'm not. I want all traffic going to sub.domain.com to be rerouted to another location.
I also want to track how this link is performing.
-
Actually, I just found
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <meta http-equiv="refresh" content="0; url=http://example.com"> <script type="text/javascript"> window.location.href = "http://example.com" </script> <title>Page Redirection</title> </head> <body> <!-- Note: don't tell people to `click` the link, just tell them that it is a link. --> If you are not redirected automatically, follow this <a href='http://example.com'>link to example</a>. </body> </html>
And I found
<!DOCTYPE HTML> <meta charset="UTF-8"> <meta http-equiv="refresh" content="1; url=http://example.com"> <script> window.location.href = "http://example.com" </script> <title>Page Redirection</title> <!-- Note: don't tell people to `click` the link, just tell them that it is a link. --> If you are not redirected automatically, follow the <a href='http://example.com'>link to example</a>
-
So I still don't know what is wrong. It should be working.
This is now what I have in index.php
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"><meta http-equiv="refresh" content="0; url=https://discord.gg/bG$$$$$$$"> <script type="text/javascript"> window.location.href = "https://discord.gg/bGH$$$$$$$" </script> <title>Community</title> </head> <script async src="https://www.googletagmanager.com/gtag/js?id=G-H65$$$$$$$"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-H65$$$$$$$'); </script> <body> <!-- Note: don't tell people to `click` the link, just tell them that it is a link. --> If you are not redirected automatically, follow this <a href='https://discord.gg/bG$$$$$$$'>link to our community</a>. </body> </html>
This is my .htaccess file
# Permanent URL redirect # RewriteEngine on # Redirect 302 / https://discord.gg/b34345345345