Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

How to use Metamod Pro for Google Analytic Script

How to use Metamod Pro for Google Analytic Script

Hi, I want to place a google analytic script right before the </head> of our virtuemart site. I want to place it on all pages except the checkout page that user enter credit card. How do I put the javascript inside a module then use metamod to assign it? Is there such a module that let you insert code into the head section? I did find plugins that does this, but will Metamod work on plugins? I also found a extension that place plugin into module but i have no idea of how to use it.

http://extensions.joomla.org/extensions … clude/6713

or is there any other better method of doing this. Please, any help is welcome.

thanks,

will

will.chen
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: How to use Metamod Pro for Google Analytic Script

Finally! I just found a module that let me load the google analytic plugin. Just one last question.

Whats the php syntax to assign this module to every single page of the site except the checkout page that let user enter credit card?


Thank you!

will.chen
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: How to use Metamod Pro for Google Analytic Script

Hi, none of the below syntax worked. It either doesn't display at all or display at all page. Any idea?

if ( $core_genius->check("pagetype not = checkout.index" and $last_step == 2 ) ) return 184;


if ($page == "checkout.index" && $last_step == "2" ) return 184;


if ($page == "checkout.index" && $last_step == 2 ) return 184;


$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ( $vm->check( "pagetype = none of checkout.index" && $last_step == "2" ) ) return 184;


$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ( $vm->check( "pagetype = none of checkout.index" and $last_step == 2 ) ) return 184;

will.chen
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: How to use Metamod Pro for Google Analytic Script

Hi Will,

the snippets above aren't going to work because $last_step has not been defined.

The exact step that the credit card is requested on will depend on your setup in VM. It's going to be something like checkout.index#4 or checkout.index#3

So try this:

$vm = JomGenius("virtuemart"); // need this at the start of every rule
if ( $vm->check( "pagetype = none of checkout.index#3" ) ) return 184;

If that's targetting the wrong page, try #2 or #4 instead of #3 and see which page the module disappears on.

Also, you could try this rule which will tell you exactly which page type it's on, then you can use this to modify the rule above:

$vm = JomGenius("virtuemart"); // need this at the start of every rule
echo "Page type: " . $vm->info( "pagetype" ) . "<br  />";


Hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: How to use Metamod Pro for Google Analytic Script

Thank you so much as always. It worked.

Are there any article/references that you can give me so i can try to learn these kind of php code? This is not found in the recipe page.

will.chen
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: How to use Metamod Pro for Google Analytic Script

Hi Will,

for reference on the JomGenius system, please check out the pages in the main menu of the site. There are *some* code examples on there, but once you have got the hang of the basic syntax of the statements, then it shouldn't be too hard to find and combine them. JomGenius is important because it allows you to query a lot of the things that go on in Joomla with a fairly simple, standardised syntax.

The other "Recipe" pages are good reference too. You should be able to pick up ideas for how to structure the PHP statements from there.

For PHP itself - I don't have any particular tutorials/web sites to recommend, but you should be able to google for these and find something at your own level and language if necessary.

For MetaMod the main things you want to learn in PHP are:

- how to do "if" statements
- how do do "ands" and "ors" as conditions within the "if" statements
- basic execution flow, e.g. {}, (), return, ";", "if", "case" etc.

Hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Re: How to use Metamod Pro for Google Analytic Script

Thanks, I will look into it.

will.chen
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1684
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5161
Newest User:
kbmgkey234q
Members Online:
0
Guests Online:
455

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked