-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaam.php
66 lines (55 loc) · 1.67 KB
/
aam.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
Plugin Name: Adsnative Analytics Module
Plugin URI: https://www.adsnative.com
Description: After installation, you must click '<a href='options-general.php?page=AdsNative-Analytics'>Settings → AdsNative Analytics Module</a>' to turn on the module.
Version: 0.0.1
Author: AdsNative
Author URI: https://www.adsnative.com
*/
define('aam_PLUGIN_VERSION', '0.0.1');
define('aam_PLUGIN_URL', PLugin_dir_url(__FILE__));
define('aam_PLUGIN_SUPPORT_EMAIL', 'contact@adsnative.com');
/**
* Print the tracking <script/> tags
*/
function aam_insert_js() {
$aam_pid = get_option('aam_pid');
$aam_PLUGIN_VERSION = aam_PLUGIN_VERSION;
$aam_api_server= get_option('aam_api_server');
if( $aam_pid && $aam_api_server ) {
?>
<!-- AdsNative Analytics Module Version: <?php print ( $aam_PLUGIN_VERSION ); ?>-->
<script type='text/javascript' id='aam-analytics'>
var _an_sid="", _an_key="<?php print ( $aam_pid ); ?>";
(function(){
var s = document.createElement('script');
s.async = true;
s.type = 'text/javascript';
s.src = document.location.protocol + "<?php print ( $aam_api_server );?>";
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(s);
})();
</script>
<!-- end AdsNative -->
<?php
}
}
/**
* Add the AAM admin section
*
*/
function aam_load_admin()
{
include_once('aam_admin.php');
}
/**
* Add the AAM admin options to the Settings Menu
*
*/
function aam_admin_actions()
{
add_options_page("AdsNative Analytics", "AdsNative Analytics", 1, "AdsNative-Analytics", "aam_load_admin");
}
add_action('wp_footer','aam_insert_js');
add_action('admin_menu','aam_admin_actions');
?>