Event Tracking
-
Hi there,
I’d like to implement a Google Analytics Event Tracking.
We’re using the Universal Analytics here. I have found this in the Knowledge Support Section but I’m suprised that I have to write the General Analytics.js code twice.
Do you think I can only add the Event code under the Universal code as follow:
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 failed subscription
function yikes_mailchimp_google_analytics_failure( response ) {ga( ‘create’, ‘UA-xxxxx-1’, ‘auto’ );
ga( ‘send’, ‘event’, ‘mailchimp-subscribe’, ‘subscription-failed’ );
}// Fire off GA event for a successful subscription
function yikes_mailchimp_google_analytics_success( response ) {
ga( ‘create’, ‘UA-xxxxx-1’, ‘auto’ );
ga( ‘send’, ‘event’, ‘mailchimp-subscribe’, ‘subscription-successful’ );
}</script>
<?php
}Thanks in advance for your help. Newbie here ??
The page I need help with: [log in to see the link]
- The topic ‘Event Tracking’ is closed to new replies.