Jump to content

Different Google Analytics Code


Pegasus83

Recommended Posts

Posted

Hi guys,

I updated this night from 3.4.8 to 4.0.12. In the old Forum I had a mobile skin with a different analytics code from the desktop one.

How could I set the new (and single) skin to load different scripts if the user is on desktop or mobile (phone and tablet)?

I tried with 

<code><div class="ipsClearfix ipsResponsive_showDesktop ipsResponsive_hideTablet ipsResponsive_hidePhone"></code>

But it does not work

Thanks!

Posted

Can't you just filter the end results? Using two different codes seems a bit silly.

Yes, I could, but I need it for my stats. A solution could be useful also for other aims.

I think it's related to a "if" statement, but I don't know how 4.0 manages these codes.

Posted

Unfortunately, as it is javascript you cannot use CSS classes to hide it as it will execute no matter what. You could use some jQuery or Javascript to detect if the window width is below 1024px (that would mean it's a tablet or mobile device) then use a variable to change out your Google analytics property ID accordingly. 

Posted

Unfortunately, as it is javascript you cannot use CSS classes to hide it as it will execute no matter what. You could use some jQuery or Javascript to detect if the window width is below 1024px (that would mean it's a tablet or mobile device) then use a variable to change out your Google analytics property ID accordingly. 

{{if in_array('ipsLayout_minimal', \IPS\Output::i()->bodyClasses )}}

can't this help me?

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...