Jump to content

davidhb21l6

New Members
  • Posts

    3
  • Joined

  • Last visited

davidhb21l6's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks for the replies, interesting that there's outputted blocks for admin or users, i'll have to look into that. its the header.php file. should be present on every page,in fact it is.. The rest of the JS is coming out OK , such as the config tag, the initial async line etc.. its just the PHP code isnt showing ? <script async src="https://www.googletagmanager.com/gtag/js?id=AW-123123123"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-123123123'); <?php $url = $_SERVER['REQUEST_URI']; if ($url =="/thankyou/") { print " gtag('event', 'conversion', {'send_to': 'AW-123123123/abcabcabcabc', 'value': 1.0, 'currency': 'GBP' }); "; print " gtag('event', 'conversion', {'send_to': 'AW-1123123123/asasasasasasasas'}); "; //Print "alert('OK');"; //Print "alert('" . $url . "');"; } ?> </script> very strange.
  2. Thanks for the reply requinix, no. i cant see the google JS as its hidden in source. However, as a test, at the top of the header.php i added this code. <%php Print “alert(‘hello’);”; ?> when i’m logged into WP and hit the page, it triggers fine, (and i can see this in sourcecode) But if i log out of WP it doesn’t ( and not visible). just something very weird going on here i think.
  3. Hi all, My company has a php site on wordpress that i’m trying to add google AD tracking to. There is a single header.php file for all pages so i’ve added a little piece of php to check what the current page is and to write out the appropriate event trigger. Now, on the live site, when i’m logged into word-press and run the page, I can see the triggers firing fine on Tag assistant, if i un-comment the alerts, they also fire. When i log out of word-press and hit the page, nothing happens at all. No alerts, no google triggers, nothing in the php is running? Any ideas whats going on ? <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-1234567897'); <?php $url = $_SERVER['REQUEST_URI']; if ($url =="/thankyou/") { print " gtag('event', 'conversion', {'send_to': 'AW-1234567897/1234567897', 'value': 1.0, 'currency': 'GBP' }); "; print " gtag('event', 'conversion', {'send_to': 'AW-1234567897/1234567897'}); "; //Print "alert('OK');"; //Print "alert('" . $url . "');"; } ?> </script> tia Dave
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.