Title: Second GA code
Last modified: June 15, 2021

---

# Second GA code

 *  Resolved [fernandorigotti](https://wordpress.org/support/users/fernandorigotti/)
 * (@fernandorigotti)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/second-ga-code/)
 * Hi there. I need to add a second GA tracking code on web-story posts.
 * I tried to use the code below but it isn’t working.
 *     ```
       add_action(
       	'web_stories_print_analytics',
       	static function() {
       		echo '<amp-analytics type="googleanalytics" id="analytics1"><script type="application/json">{"vars":{"account":"UA-XXXXXX"},"triggers":{"trackPageview":{"on":"visible","request":"pageview","extraUrlParams":{"cd1":"<?php echo get_the_date("M-Y"); ?>"}}}}</script></amp-analytics>';
       	}
       );
       add_action('wp-footer', 'web_stories_print_analytics');
       ```
   
 * Anyone can help me? Thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Luckyna San](https://wordpress.org/support/users/luckynasan/)
 * (@luckynasan)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/second-ga-code/#post-14563193)
 * [@fernandorigotti](https://wordpress.org/support/users/fernandorigotti/) Hello!
   Thank you for posting your topic. The Web Stories plugin already comes with the
   analytics configuration. All you have to do is enter your [tracking ID in the settings](https://jmp.sh/GKtbqD0).
   Does this answer your question?
 *  [Bethany Chobanian Lang](https://wordpress.org/support/users/mxbclang/)
 * (@mxbclang)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/second-ga-code/#post-14592553)
 * [@fernandorigotti](https://wordpress.org/support/users/fernandorigotti/) As we
   haven’t received a response, I’ll mark this as resolved. Feel free to open a 
   [new support topic](https://wordpress.org/support/plugin/web-stories/#new-post)
   if you continue to encounter issues, or reopen this topic and we’d be happy to
   assist. Thank you!
 *  Plugin Author [Pascal Birchler](https://wordpress.org/support/users/swissspidy/)
 * (@swissspidy)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/second-ga-code/#post-14592592)
 * FWIW, using `add_action('web_stories_print_analytics', function() { ... })` would
   be correct. Just make sure your `<amp-analytics>` configuration is valid AMP.
   For example, you should use `<amp-analytics type="gtag" data-credentials="include"
   >` — `data-credentials="include"` was missing in your example.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Second GA code’ is closed to new replies.

 * ![](https://ps.w.org/web-stories/assets/icon.svg?rev=2386543)
 * [Web Stories](https://wordpress.org/plugins/web-stories/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/web-stories/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/web-stories/)
 * [Active Topics](https://wordpress.org/support/plugin/web-stories/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/web-stories/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/web-stories/reviews/)

 * 3 replies
 * 4 participants
 * Last reply from: [Pascal Birchler](https://wordpress.org/support/users/swissspidy/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/second-ga-code/#post-14592592)
 * Status: resolved