Tagged: AdWords, conversion tracking, google ads
-
AuthorPosts
-
January 2, 2019 at 8:55 pm #1049372
Hello,
I have a simple enfold website without woocommerce.
I do Google Ads and would like to add the conversion tracking code. The conversion is a specific page load.
What is the best way to add the global site tag and the event snippet?
Thank you in advance!
Hazlitt
- This topic was modified 5 years, 11 months ago by Hazlitt. Reason: typing error
January 3, 2019 at 7:20 am #1049508Hey Hazlitt,
What code do you need to add and where? Please try to be as specific as possible.
Best regards,
RikardJanuary 3, 2019 at 11:01 am #1049564Hey Rikard,
The global site tag adds visitors to your basic remarketing lists and sets new cookies on your domain, which will store information about the ad click that brought a user to your website. You must install this tag on every page of your website.
…
Copy the tag below and paste it in between the <head></head> tags of every page of your website. You only need to install the global site tag once per account, even if you’re tracking multiple actions.<!– Global site tag (gtag.js) – Google Ads: 123456789 –>
<script async src=”https://www.googletagmanager.com/gtag/js?id=AW-123456789″></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());gtag(‘config’, ‘AW-123456789’);
</script>The event snippet works with the global site tag to track actions that should be counted as conversions…
Add the snippet to the page that a customer reaches after completing a conversion:
Copy the snippet below and paste it in between the <head></head> tags of the page that you’d like to track, right after the global site tag.<!– Event snippet for xyz conversion page –>
<script>
gtag(‘event’, ‘conversion’, {‘send_to’: ‘AW-123456789/xxxxxx_NUD’});
</script>Best regards,
Hazlitt- This reply was modified 5 years, 11 months ago by Hazlitt.
January 4, 2019 at 5:26 am #1049800Hi,
Thanks for that, please try this in your functions.php file:
function hazlitt_add_goole_scripts(){ ?> <script async src=”https://www.googletagmanager.com/gtag/js?id=AW-123456789″></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, ‘AW-123456789’); </script> <script> gtag(‘event’, ‘conversion’, {‘send_to’: ‘AW-123456789/xxxxxx_NUD’}); </script> <?php } add_action('wp_head', 'hazlitt_add_goole_scripts');
Best regards,
RikardJanuary 15, 2019 at 1:23 pm #1054106Hi,
Is this: add_action(‘wp_head’, ‘hazlitt_add_goole_scripts’);
is the page where the header will contain this script?
If that so how should I write the name of the page in my case?January 15, 2019 at 6:48 pm #1054266Hi vntr,
Yes, this will be shown in all pages.
You need to add the check for which page id it is
If you need further assistance please let us know.
Best regards,
VictoriaJanuary 16, 2019 at 9:23 am #1054504This reply has been marked as private.January 18, 2019 at 5:11 pm #1055513Hi vntr,
Here is the code you can put in your funtions.php
function hazlitt_add_goole_scripts(){ if (is_page(9012)) { ?> <script async src=”https://www.googletagmanager.com/gtag/js?id=AW-123456789″></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(‘js’, new Date()); gtag(‘config’, ‘AW-123456789’); </script> <script> gtag(‘event’, ‘conversion’, {‘send_to’: ‘AW-123456789/xxxxxx_NUD’}); </script> <?php } } add_action('wp_head', 'hazlitt_add_goole_scripts');
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.