0

I'm very new to Google Analytics.

How can I make a virtual pageview only for a dynamic page included in a HTML template?

Please just refer to my code below to know more details of the situation.

A dynamic page [Price Details] pops out when you press the button [Show Price].

URL or even template doesn't change when this dynamic output appears, because they both are in ONE template.

I'd like to count up how many people actually have seen [Price Details], so can anyone tell me how to get a virtual pageview only for the dynamic page?

I'm using gtag for your info. I will appreciate so much any idea about this! Thanks!

<div class="section">
<a href="#" id="buttonSet" class="button"><span>Show Price</span></a>
</div>
・・・
・・・
bla bla
・・・
・・・
<header class="head">
    <p class="title">Price Details</p>
</header>
user9191983
  • 505
  • 1
  • 4
  • 20

1 Answers1

0

Try adding the below onclick pageview trigger:

<a href="#" id="buttonSet" class="button" onClick="ga(‘send’, ‘pageview’, ‘/virtual/guides/download/social-media-guide.pdf’);><span>Show Price</span></a>
Aiyanna K
  • 458
  • 2
  • 18