Skip to content

Commit

Permalink
Implement basic js implemetation
Browse files Browse the repository at this point in the history
  • Loading branch information
sleemy1997 committed Jan 8, 2019
1 parent 9b0a23e commit 750a189
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions gaOpOut.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,35 @@

class gaOpOut
{
//gap Id
// view
public $view;
//gap Id
public $gaAppId;
//output call event
//output call event
public $optOutCallEvent = 'click';
//element selector with link to jsoutput
//element selector with link to jsoutput
public $elementSelector = '[href="#jsgaoptout"]';

//Debug default false
//Debug default false
public $debug = false;

public $showAlterAfterDeactivate = true;

public function registerGaOpOut($view, $gaAppId, $optOutCallEvent, $elementSelector, $debug, $showAlterAfterDeactivate)
{
Assets::register($view);
$view->registerJs("
<script>
(function() {
window.onload = function () {
var gaOptOut = new ApGaOptOut({
gaAppId: $gaAppId,
optOutCallEvent: $optOutCallEvent,
elementSelector: $elementSelector,
debug: $debug,
showAlterAfterDeactivate: $showAlterAfterDeactivate
});
}
})();
</script>");
}
}

0 comments on commit 750a189

Please sign in to comment.