Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2015-12-02 14:58:42

Genox
Member
Registered: 2015-08-08
Posts: 31

How to use StatCounter with TTG

Hello,
Can I use StatCounter in my TTG site?
If yes, please tell me how.
http://www.statcounter.com

Thanks
Gene

Offline

#2 2015-12-02 15:57:09

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: How to use StatCounter with TTG

You should be able to inject whatever code they'd like you to paste into the page via PHPlugins. You can see documentation on how to do this.


Matt

The Turning Gate, http://theturninggate.net

Offline

#3 2015-12-04 10:29:33

Genox
Member
Registered: 2015-08-08
Posts: 31

Re: How to use StatCounter with TTG

I have PHPlugins installed.
Where can I find the documentation on how to install?

Offline

#4 2015-12-04 10:57:51

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: How to use StatCounter with TTG

phplugins documentation is near the bottom of the main Documentation page:
http://ce4.theturninggate.net/docs/doku … bility_api


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#5 2015-12-07 14:44:47

Genox
Member
Registered: 2015-08-08
Posts: 31

Re: How to use StatCounter with TTG

When I embed the Statcounter code into the Phplugins doc and upload to my site the home page does not show.
Is there a specific area (line) of the file that I should insert the code?
Thanks
Gene

Offline

#6 2015-12-07 16:25:53

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: How to use StatCounter with TTG

Please post a copy of your code so we can help you get it working.


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#7 2015-12-07 22:36:08

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: How to use StatCounter with TTG

Where do the Statcounter documents tell you to put the code? That will determine which hook function to use. You can see the list of hook locations and how they work in the phplugins documentation.
http://ce4.theturninggate.net/docs/doku … _functions


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#8 2015-12-08 07:06:44

Genox
Member
Registered: 2015-08-08
Posts: 31

Re: How to use StatCounter with TTG

Here is the code for StatCounter.

<!-- Start of StatCounter Code for Default Guide -->
<script type="text/javascript">
var sc_project=10687930;
var sc_invisible=0;
var sc_security="7ca145a0";
var scJsHost = (("https:" == document.location.protocol) ?
"https://secure." : "http://www.");
document.write("<sc"+"ript type='text/javascript' src='" +
scJsHost+
"statcounter.com/counter/counter.js'></"+"script>");
</script>
<noscript><div class="statcounter"><a title="shopify
analytics" href="http://statcounter.com/shopify/"
target="_blank"><img class="statcounter"
src="http://c.statcounter.com/10687930/0/7ca145a0/0/"
alt="shopify analytics"></a></div></noscript>
<!-- End of StatCounter Code for Default Guide -->

Offline

#9 2015-12-08 07:49:15

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: How to use StatCounter with TTG

ok. Where do they say it needs to go? In the body of the page? in the <head> tag? The footer?

wherever that is will determine which hook to use.

does this need to go in every page? Just the home page?


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#10 2015-12-08 08:23:35

Genox
Member
Registered: 2015-08-08
Posts: 31

Re: How to use StatCounter with TTG

They ask the code to be placed "just inside the closing "body" tag - </body>".

Just the home page. I just want to know when someone visits the site.(# per day, wk, mo.)
Thanks

Offline

#11 2015-12-08 08:50:48

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: How to use StatCounter with TTG

ok, try using this:

//Add StatCounter
    function ttg_body_bottom( $style, $path ) {
    if (G_STYLE== 'CE4-PAGES-HOME'  ){
    echo'
            <!-- Start of StatCounter Code for Default Guide -->
        <script type="text/javascript">
        var sc_project=10687930;
        var sc_invisible=0;
        var sc_security="7ca145a0";
        var scJsHost = (("https:" == document.location.protocol) ?
        "https://secure." : "http://www.");
        document.write("<sc"+"ript type=\'text/javascript\' src=\'" +
        scJsHost+
        "statcounter.com/counter/counter.js\'></"+"script>");
        </script>
        <noscript><div class="statcounter"><a title="shopify
        analytics" href="http://statcounter.com/shopify/"
        target="_blank"><img class="statcounter"
        src="http://c.statcounter.com/10687930/0/7ca145a0/0/"
        alt="shopify analytics"></a></div></noscript>
        <!-- End of StatCounter Code for Default Guide --> 
        ';
        }
    }
//END

this assumes you're using the regular CE4 Pages home page and are not replacing it via Publisher. If you are replacing the home page with a Publisher controlled album, then there will need to be a slight change.

you'll notice that I altered the code some. I added escape characters ( \ ) prior to any single quotes. This is because single quotes would close the echo statement and mess things up.

Place the above code in the USER FUNCTIONS area of the phplugins.php file


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

Board footer

Powered by FluxBB