• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Google Analytics

Explorer ,
Dec 11, 2019 Dec 11, 2019

Copy link to clipboard

Copied

Hello,

 

Looking to hopefully have Google analytics pick-up when a user reaches a certain (canvas) frame - roughly, a frame would equal a page on a normal website as far as GA is concerned. Is this possible to do? ..and if so, could you please advise the script for the frame?

 

Thank you.

TOPICS
Code , How to , Other , Timeline

Views

665

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 11, 2019 Dec 11, 2019

google: javascript and google analytics.

Votes

Translate

Translate
Community Expert ,
Dec 11, 2019 Dec 11, 2019

Copy link to clipboard

Copied

google: javascript and google analytics.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 11, 2019 Dec 11, 2019

Copy link to clipboard

Copied

...and so you're right.

 

Specifically, this is pretty good.

https://www.optimizesmart.com/beginners-guide-to-javascript-for-google-analytics/#a3

 

Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 24, 2024 Jan 24, 2024

Copy link to clipboard

Copied

LATEST

Yes, it's possible. You can use the following JavaScript code to trigger a virtual pageview in Google Analytics when a user reaches a specific point in the frame:

html
<script>document.getElementById('canvasFrame').contentWindow.onscroll = function() { var scrollThreshold = 500; if (document.getElementById('canvasFrame').contentWindow.pageYOffset >= scrollThreshold) { ga('send', 'pageview', '/virtual/page/on/canvas-frame'); } }; </script>

Adjust the scrollThreshold and virtual page path as needed. Make sure your Google Analytics tracking code is properly set up on your website.

 
 
 
 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines