Monstroid. 如何添加谷歌分析代码
2016年5月27日
本教程将指导您完成添加 谷歌分析 code to Monstroid templates.
获取谷歌分析代码
登录你的 谷歌分析 account.
Click the Admin tab.
Select Account from the Account column.
Select Property 在下一栏.
在属性下选择 跟踪信息 > 跟踪代码 option:
Copy 跟踪代码:
添加谷歌分析跟踪代码到您的网站.
登录你的WordPress管理面板.
Navigate to Cherry > Options section:
Enter you 跟踪代码 to the 谷歌分析 code 磁场下 General tab:
单击保存选项.
Note that 谷歌分析 block 添加到Cherry Options 从模板55966 +开始. 如果您的模板编号低于55966,请按照以下步骤操作:
Open “wp-content /主题/ themeXXXXX /功能.php’ file:
Add 下面的代码到文件的最后:
add_filter('cherry_general_options_list', 'themeXXXX_new_settings'); ($options) { $new_options = array( 'google_analytics' => array( 'type' => 'textarea', 'title' => __( '谷歌分析 Code', 'themeXXXX'), 'description' => __( 'You can paste your 谷歌分析 or other tracking code in this box. 这将自动添加到页脚.', 'themeXXXX'), 'value' => '', ) ); $options = array_merge($options, $new_options); 返回选择美元; } add_filter('wp_footer', 'themeXXXX_google_analytics', 9999); 函数themeXXXX_google_analytics () { If (cherry_get_option('google_analytics')) { echo ''; } }
Save 这些变化.
Clear your browser cache 然后导航到 Cherry Options > General tab. 谷歌分析 块应该出现在页面的最底部.
Enter you 跟踪代码 to the 谷歌分析 code 磁场下 General tab:
单击保存选项.
请随时查看下面的详细视频教程:
Monstroid. 如何添加谷歌分析代码