Event / Conversion tracking – Google Tag Manager
-
Hi, I use Google Tag Manager and I want to track events / conversions on succesfully send form. I tried to set up event tracking from this comment – https://www.ads-software.com/support/topic/event-tracking-16/#post-9752485.
So I tried this code in functions.php (in child theme):
/*Mailchimp event Tracking*/
add_action( ‘yikes-mailchimp-google-analytics’, ‘yikes_mailchimp_google_analytics’, 10, 1 );
function yikes_mailchimp_google_analytics( $form_id ) {
?>
<script type=”text/javascript”>var form_id = <?php echo $form_id; ?>;
// Fire off GA event for a successful subscription
function yikes_mailchimp_google_analytics_success( response ) {
ga( ‘create’, ‘UA-XXXXXX’, ‘auto’ );
ga( ‘send’, ‘event’, ‘mailchimp-subscribe’, ‘subscription-successful’ );
fbq(‘track’, ‘CompleteRegistration’);
}</script>
<?php
}/*Mailchimp event Tracking*/
But I have this alert on front end of every page:
Warning: Use of undefined constant ‘yikes – assumed ‘‘yikes’ (this will throw an Error in a future version of PHP) in /nfsmnt/hosting1_1/f/f/ffb1a4f4-7f07-4e86-94a9-5462dca84a8c/vidadu.net/web/wp-content/themes/ark-child/functions.php on line 56Warning: Use of undefined constant mailchimp – assumed ‘mailchimp’ (this will throw an Error in a future version of PHP) in /nfsmnt/hosting1_1/f/f/ffb1a4f4-7f07-4e86-94a9-5462dca84a8c/vidadu.net/web/wp-content/themes/ark-child/functions.php on line 56
Warning: A non-numeric value encountered in /nfsmnt/hosting1_1/f/f/ffb1a4f4-7f07-4e86-94a9-5462dca84a8c/vidadu.net/web/wp-content/themes/ark-child/functions.php on line 56
Warning: Use of undefined constant google – assumed ‘google’ (this will throw an Error in a future version of PHP) in /nfsmnt/hosting1_1/f/f/ffb1a4f4-7f07-4e86-94a9-5462dca84a8c/vidadu.net/web/wp-content/themes/ark-child/functions.php on line 56
Warning: A non-numeric value encountered in /nfsmnt/hosting1_1/f/f/ffb1a4f4-7f07-4e86-94a9-5462dca84a8c/vidadu.net/web/wp-content/themes/ark-child/functions.php on line 56
Warning: Use of undefined constant analytics’ – assumed ‘analytics’’ (this will throw an Error in a future version of PHP) in /nfsmnt/hosting1_1/f/f/ffb1a4f4-7f07-4e86-94a9-5462dca84a8c/vidadu.net/web/wp-content/themes/ark-child/functions.php on line 56
Warning: A non-numeric value encountered in /nfsmnt/hosting1_1/f/f/ffb1a4f4-7f07-4e86-94a9-5462dca84a8c/vidadu.net/web/wp-content/themes/ark-child/functions.php on line 56
Warning: Use of undefined constant ‘yikes_mailchimp_google_analytics’ – assumed ‘‘yikes_mailchimp_google_analytics’’ (this will throw an Error in a future version of PHP) in /nfsmnt/hosting1_1/f/f/ffb1a4f4-7f07-4e86-94a9-5462dca84a8c/vidadu.net/web/wp-content/themes/ark-child/functions.php on line 56
This is Line 56 – add_action( ‘yikes-mailchimp-google-analytics’, ‘yikes_mailchimp_google_analytics’, 10, 1 );
NOW I DELETED THAT CODE, BECAUSE THAT ALERT WAS ANNOYING ON SITE
What is wrong?
Thanks for any help :).
The page I need help with: [log in to see the link]
- The topic ‘Event / Conversion tracking – Google Tag Manager’ is closed to new replies.