Welcome to TalkGraphics.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2007
    Location
    Sunshine Coast BC, Canada. In a beautiful part of BC's temperate rainforest
    Posts
    9,864

    Default Google Analytics tagging a link

    I've added Google Analytics to my website and it works great, but what I would really like to do is tag the "download this week's issue" link so i can track how many times the pdf file is downloaded. The GA help page says: For example, to log every click on a particular link to www.example.com/files/map.pdf as a pageview for /downloads/map you would add the following attribute to the link's <a> tag:

    <a href="http://www.example.com/files/map.pdf" onClick="javascript: pageTracker._trackPageview('/downloads/map'); ">


    I don't know anything about html code (That's why I bought XWD) How and where do I insert this code? Any help is much appreciated.
    [SIGPIC][/SIGPIC]
    My current Xara software: Designer Pro 365 12.6

    Good Morning Sunshine.ca | Good Morning Sunshine Online(a weekly humorous publication created with XDP and exported as a web document) | Angelize Online resource shop | My Video Tutorials | My DropBox |
    Autocorrect: It can be your worst enema.

  2. #2
    Join Date
    Aug 2004
    Location
    Ukraine
    Posts
    3,904

    Default Re: Google Analytics tagging a link

    Hi Frances.

    In WD you can not add "onClick" event to the link. But you can add this code to the URL field. Simply enter following code to the link field of your button or text that you want to link to the PDF:
    Code:
    javascript:pageTracker._trackPageview("/downloads/map");window.open("http://www.example.com/files/map.pdf","_self");
    If you want the PDF to be opened in new window, then you can change it a bit:
    Code:
    javascript:pageTracker._trackPageview("/downloads/map");window.open("http://www.example.com/files/map.pdf","_blank");
    Hope this helps.
    John.

  3. #3
    Join Date
    Dec 2007
    Location
    Sunshine Coast BC, Canada. In a beautiful part of BC's temperate rainforest
    Posts
    9,864

    Default Re: Google Analytics tagging a link

    John, I tried inserting the code from your post into the url field on the link tab with my details substituted for Google's example but when I go to preview I get an error message that says " this page does not exist" I've attached my .web file and a screenshot of the error message what did I do wrong?
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	error web.png 
Views:	216 
Size:	48.3 KB 
ID:	57540  
    Attached Files Attached Files
    Last edited by angelize; 13 March 2009 at 09:43 PM.
    [SIGPIC][/SIGPIC]
    My current Xara software: Designer Pro 365 12.6

    Good Morning Sunshine.ca | Good Morning Sunshine Online(a weekly humorous publication created with XDP and exported as a web document) | Angelize Online resource shop | My Video Tutorials | My DropBox |
    Autocorrect: It can be your worst enema.

  4. #4
    Join Date
    Dec 2007
    Location
    Sunshine Coast BC, Canada. In a beautiful part of BC's temperate rainforest
    Posts
    9,864

    Default Re: Google Analytics tagging a link

    I figured it out. It helps if you use the correct file name
    [SIGPIC][/SIGPIC]
    My current Xara software: Designer Pro 365 12.6

    Good Morning Sunshine.ca | Good Morning Sunshine Online(a weekly humorous publication created with XDP and exported as a web document) | Angelize Online resource shop | My Video Tutorials | My DropBox |
    Autocorrect: It can be your worst enema.

  5. #5
    Join Date
    Dec 2007
    Location
    Sunshine Coast BC, Canada. In a beautiful part of BC's temperate rainforest
    Posts
    9,864

    Default Re: Google Analytics tagging a link

    I just checked my Google Analytics report and all is working great.

    Thanks John for your help.
    [SIGPIC][/SIGPIC]
    My current Xara software: Designer Pro 365 12.6

    Good Morning Sunshine.ca | Good Morning Sunshine Online(a weekly humorous publication created with XDP and exported as a web document) | Angelize Online resource shop | My Video Tutorials | My DropBox |
    Autocorrect: It can be your worst enema.

  6. #6
    Join Date
    Aug 2004
    Location
    Ukraine
    Posts
    3,904

    Default Re: Google Analytics tagging a link

    My pleasure.
    John.

  7. #7
    Join Date
    Jun 2010
    Location
    Miami
    Posts
    34

    Default Re: Google Analytics tagging a link

    Quote Originally Posted by angelize View Post
    I've added Google Analytics to my website and it works great, but what I would really like to do is tag the "download this week's issue" link so i can track how many times the pdf file is downloaded. The GA help page says: For example, to log every click on a particular link to www.example.com/files/map.pdf as a pageview for /downloads/map you would add the following attribute to the link's <a> tag:

    <a href="http://www.example.com/files/map.pdf" onClick="javascript: pageTracker._trackPageview('/downloads/map'); ">


    I don't know anything about html code (That's why I bought XWD) How and where do I insert this code? Any help is much appreciated.
    did you place the code under the page tab or website tab?

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •